<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE DeriveDataTypeable, CPP, BangPatterns, RankNTypes,
             ForeignFunctionInterface, MagicHash, UnboxedTuples,
             UnliftedFFITypes #-}</span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-5"></span><span class="hs-pragma">{-# OPTIONS_GHC -fno-warn-name-shadowing #-}</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 703
</span><span class="hs-pragma">{-# LANGUAGE Unsafe #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-pragma">{-# OPTIONS_HADDOCK not-home #-}</span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Module      : Data.ByteString.Short.Internal</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Copyright   : (c) Duncan Coutts 2012-2013</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- License     : BSD-style</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Maintainer  : duncan@community.haskell.org</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- Stability   : stable</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Portability : ghc only</span><span>
</span><span id="line-19"></span><span class="hs-comment">--</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- Internal representation of ShortByteString</span><span>
</span><span id="line-21"></span><span class="hs-comment">--</span><span>
</span><span id="line-22"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.ByteString.Short.Internal</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-23"></span><span>
</span><span id="line-24"></span><span>    </span><span class="annot"><span class="hs-comment">-- * The @ShortByteString@ type and representation</span></span><span>
</span><span id="line-25"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier">ShortByteString</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Conversions</span></span><span>
</span><span id="line-28"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#toShort"><span class="hs-identifier">toShort</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#fromShort"><span class="hs-identifier">fromShort</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#pack"><span class="hs-identifier">pack</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#unpack"><span class="hs-identifier">unpack</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-32"></span><span>
</span><span id="line-33"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Other operations</span></span><span>
</span><span id="line-34"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#empty"><span class="hs-identifier">empty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#null"><span class="hs-identifier">null</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier">length</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#index"><span class="hs-identifier">index</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#unsafeIndex"><span class="hs-identifier">unsafeIndex</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Low level operations</span></span><span>
</span><span id="line-37"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#createFromPtr"><span class="hs-identifier">createFromPtr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#copyToPtr"><span class="hs-identifier">copyToPtr</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Low level conversions</span></span><span>
</span><span id="line-40"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Packing 'CString's and pointers</span></span><span>
</span><span id="line-41"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#packCString"><span class="hs-identifier">packCString</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-42"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#packCStringLen"><span class="hs-identifier">packCStringLen</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Using ByteStrings as 'CString's</span></span><span>
</span><span id="line-45"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#useAsCString"><span class="hs-identifier">useAsCString</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-46"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#useAsCStringLen"><span class="hs-identifier">useAsCStringLen</span></a></span><span>
</span><span id="line-47"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-48"></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html"><span class="hs-identifier">Data.ByteString.Internal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier">ByteString</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#accursedUnutterablePerformIO"><span class="hs-identifier">accursedUnutterablePerformIO</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#c_strlen"><span class="hs-identifier">c_strlen</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Typeable.html#"><span class="hs-identifier">Data.Typeable</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Typeable.Internal.html#Typeable"><span class="hs-identifier">Typeable</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#"><span class="hs-identifier">Data.Data</span></a></span><span>        </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Data.html#Data"><span class="hs-identifier">Data</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#mkNoRepType"><span class="hs-identifier">mkNoRepType</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if MIN_VERSION_base(4,9,0)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Semigroup.html#"><span class="hs-identifier">Data.Semigroup</span></a></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier">Semigroup</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator">(&lt;&gt;)</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Monoid.html#"><span class="hs-identifier">Data.Monoid</span></a></span><span>      </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier">Monoid</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.String.html#"><span class="hs-identifier">Data.String</span></a></span><span>      </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.String.html#IsString"><span class="hs-identifier">IsString</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#"><span class="hs-identifier">Control.DeepSeq</span></a></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#NFData"><span class="hs-identifier">NFData</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">List</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier">length</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.String.html#"><span class="hs-identifier">Foreign.C.String</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Foreign.C.String.html#CString"><span class="hs-identifier">CString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.String.html#CStringLen"><span class="hs-identifier">CStringLen</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if MIN_VERSION_base(4,7,0)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#"><span class="hs-identifier">Foreign.C.Types</span></a></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#CSize"><span class="hs-identifier">CSize</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#CInt"><span class="hs-identifier">CInt</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#elif MIN_VERSION_base(4,4,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.C.Types</span><span>  </span><span class="hs-special">(</span><span class="hs-identifier">CSize</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">CInt</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">CLong</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.C.Types</span><span>  </span><span class="hs-special">(</span><span class="hs-identifier">CSize</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">CInt</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">CLong</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.Marshal.Alloc.html#"><span class="hs-identifier">Foreign.Marshal.Alloc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Foreign.Marshal.Alloc.html#allocaBytes"><span class="hs-identifier">allocaBytes</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.Ptr.html#"><span class="hs-identifier">Foreign.Ptr</span></a></span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.ForeignPtr.html#"><span class="hs-identifier">Foreign.ForeignPtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#touchForeignPtr"><span class="hs-identifier">touchForeignPtr</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if MIN_VERSION_base(4,5,0)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.ForeignPtr.Unsafe.html#"><span class="hs-identifier">Foreign.ForeignPtr.Unsafe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#unsafeForeignPtrToPtr"><span class="hs-identifier">unsafeForeignPtrToPtr</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign.ForeignPtr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unsafeForeignPtrToPtr</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.Storable.html#"><span class="hs-identifier">Foreign.Storable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Foreign.Storable.html#pokeByteOff"><span class="hs-identifier">pokeByteOff</span></a></span><span class="hs-special">)</span><span class="hs-cpp">

#if MIN_VERSION_base(4,5,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exts.html#"><span class="hs-identifier">GHC.Exts</span></a></span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exts.html#"><span class="hs-identifier">GHC.Exts</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier">Int</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier">I#</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier">Int#</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier">Ptr</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier">Ptr</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Addr%23"><span class="hs-identifier">Addr#</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier">Char</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#C%23"><span class="hs-identifier">C#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-82"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#State%23"><span class="hs-identifier">State#</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#RealWorld"><span class="hs-identifier">RealWorld</span></a></span><span>
</span><span id="line-83"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#ByteArray%23"><span class="hs-identifier">ByteArray#</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#MutableByteArray%23"><span class="hs-identifier">MutableByteArray#</span></a></span><span>
</span><span id="line-84"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#newByteArray%23"><span class="hs-identifier">newByteArray#</span></a></span><span class="hs-cpp">
#if MIN_VERSION_base(4,6,0)
</span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#newPinnedByteArray%23"><span class="hs-identifier">newPinnedByteArray#</span></a></span><span>
</span><span id="line-87"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#byteArrayContents%23"><span class="hs-identifier">byteArrayContents#</span></a></span><span>
</span><span id="line-88"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Unsafe.Coerce.html#unsafeCoerce%23"><span class="hs-identifier">unsafeCoerce#</span></a></span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if MIN_VERSION_base(4,3,0)
</span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#sizeofByteArray%23"><span class="hs-identifier">sizeofByteArray#</span></a></span><span class="hs-cpp">
#endif
</span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#indexWord8Array%23"><span class="hs-identifier">indexWord8Array#</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#indexCharArray%23"><span class="hs-identifier">indexCharArray#</span></a></span><span>
</span><span id="line-94"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#writeWord8Array%23"><span class="hs-identifier">writeWord8Array#</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#writeCharArray%23"><span class="hs-identifier">writeCharArray#</span></a></span><span>
</span><span id="line-95"></span><span>                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#unsafeFreezeByteArray%23"><span class="hs-identifier">unsafeFreezeByteArray#</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-96"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#"><span class="hs-identifier">GHC.IO</span></a></span><span class="hs-cpp">
#if MIN_VERSION_base(4,6,0)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#"><span class="hs-identifier">GHC.ForeignPtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#ForeignPtr"><span class="hs-identifier">ForeignPtr</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#ForeignPtr"><span class="hs-identifier">ForeignPtr</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#ForeignPtrContents"><span class="hs-identifier">ForeignPtrContents</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#PlainPtr"><span class="hs-identifier">PlainPtr</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.ForeignPtr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mallocPlainForeignPtrBytes</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#"><span class="hs-identifier">GHC.ST</span></a></span><span>         </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier">ST</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier">ST</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#runST"><span class="hs-identifier">runST</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-103"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#"><span class="hs-identifier">GHC.Word</span></a></span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier">Eq</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier">Ord</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Ordering"><span class="hs-identifier">Ordering</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Read.html#Read"><span class="hs-identifier">Read</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier">Show</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-106"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator">($)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier">error</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator">(++)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#."><span class="hs-operator">(.)</span></a></span><span>
</span><span id="line-107"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier">String</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Exception.html#userError"><span class="hs-identifier">userError</span></a></span><span>
</span><span id="line-108"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier">Bool</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator">(&amp;&amp;)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier">otherwise</span></a></span><span>
</span><span id="line-109"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator">(+)</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier">fromIntegral</span></a></span><span>
</span><span id="line-110"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier">return</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-111"></span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span class="hs-comment">-- | A compact representation of a 'Word8' vector.</span><span>
</span><span id="line-114"></span><span class="hs-comment">--</span><span>
</span><span id="line-115"></span><span class="hs-comment">-- It has a lower memory overhead than a 'ByteString' and does not</span><span>
</span><span id="line-116"></span><span class="hs-comment">-- contribute to heap fragmentation. It can be converted to or from a</span><span>
</span><span id="line-117"></span><span class="hs-comment">-- 'ByteString' (at the cost of copying the string data). It supports very few</span><span>
</span><span id="line-118"></span><span class="hs-comment">-- other operations.</span><span>
</span><span id="line-119"></span><span class="hs-comment">--</span><span>
</span><span id="line-120"></span><span class="hs-comment">-- It is suitable for use as an internal representation for code that needs</span><span>
</span><span id="line-121"></span><span class="hs-comment">-- to keep many short strings in memory, but it /should not/ be used as an</span><span>
</span><span id="line-122"></span><span class="hs-comment">-- interchange type. That is, it should not generally be used in public APIs.</span><span>
</span><span id="line-123"></span><span class="hs-comment">-- The 'ByteString' type is usually more suitable for use in interfaces; it is</span><span>
</span><span id="line-124"></span><span class="hs-comment">-- more flexible and it supports a wide range of operations.</span><span>
</span><span id="line-125"></span><span class="hs-comment">--</span><span>
</span><span id="line-126"></span><span class="hs-keyword">data</span><span> </span><span id="ShortByteString"><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-var">ShortByteString</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="SBS"><span class="annot"><a href="Data.ByteString.Short.Internal.html#SBS"><span class="hs-identifier hs-var">SBS</span></a></span></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#ByteArray%23"><span class="hs-identifier hs-type">ByteArray#</span></a></span><span class="hs-cpp">
#if !(MIN_VERSION_base(4,3,0))
</span><span>           </span><span class="hs-pragma">{-# UNPACK</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-glyph">!</span><span class="hs-identifier">Int</span><span>  </span><span class="hs-comment">-- ^ Prior to ghc-7.0.x, 'ByteArray#'s reported</span><span>
</span><span id="line-129"></span><span>                                </span><span class="hs-comment">-- their length rounded up to the nearest word.</span><span>
</span><span id="line-130"></span><span>                                </span><span class="hs-comment">-- This means we have to store the true length</span><span>
</span><span id="line-131"></span><span>                                </span><span class="hs-comment">-- separately, wasting a word.</span><span class="hs-cpp">
#define LEN(x) (x)
</span><span class="hs-cpp">#else
</span><span class="hs-cpp">#define _len   /* empty */
</span><span class="hs-cpp">#define LEN(x) /* empty */
</span><span class="hs-cpp">#endif
</span><span>    </span><span class="hs-keyword">deriving</span><span> </span><span class="annot"><a href="../../base/src/Data.Typeable.Internal.html#Typeable"><span class="hs-identifier hs-type">Typeable</span></a></span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span class="hs-comment">-- The ByteArray# representation is always word sized and aligned but with a</span><span>
</span><span id="line-140"></span><span class="hs-comment">-- known byte length. Our representation choice for ShortByteString is to leave</span><span>
</span><span id="line-141"></span><span class="hs-comment">-- the 0--3 trailing bytes undefined. This means we can use word-sized writes,</span><span>
</span><span id="line-142"></span><span class="hs-comment">-- but we have to be careful with reads, see equateBytes and compareBytes below.</span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679072116"><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier hs-type">Eq</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-146"></span><span>    </span><span id="local-6989586621679072114"><span class="annot"><span class="annottext">== :: ShortByteString -&gt; ShortByteString -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">(==)</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; ShortByteString -&gt; Bool
</span><a href="Data.ByteString.Short.Internal.html#equateBytes"><span class="hs-identifier hs-var">equateBytes</span></a></span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679072098"><span id="local-6989586621679072100"><span id="local-6989586621679072102"><span id="local-6989586621679072104"><span id="local-6989586621679072106"><span id="local-6989586621679072108"><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier hs-type">Ord</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-149"></span><span>    </span><span id="local-6989586621679072096"><span class="annot"><span class="annottext">compare :: ShortByteString -&gt; ShortByteString -&gt; Ordering
</span><a href="../../ghc-prim/src/GHC.Classes.html#compare"><span class="hs-identifier hs-var hs-var hs-var hs-var">compare</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; ShortByteString -&gt; Ordering
</span><a href="Data.ByteString.Short.Internal.html#compareBytes"><span class="hs-identifier hs-var">compareBytes</span></a></span><span class="hs-cpp">

#if MIN_VERSION_base(4,9,0)
</span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679072089"><span id="local-6989586621679072091"><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier hs-type">Semigroup</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-153"></span><span>    </span><span id="local-6989586621679072087"><span class="annot"><span class="annottext">&lt;&gt; :: ShortByteString -&gt; ShortByteString -&gt; ShortByteString
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">(&lt;&gt;)</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; ShortByteString -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#append"><span class="hs-identifier hs-var">append</span></a></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-156"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-157"></span><span>    </span><span id="local-6989586621679072078"><span class="annot"><span class="annottext">mempty :: ShortByteString
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var hs-var hs-var hs-var">mempty</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-cpp">
#if MIN_VERSION_base(4,9,0)
</span><span>    </span><span id="local-6989586621679072076"><span class="annot"><span class="annottext">mappend :: ShortByteString -&gt; ShortByteString -&gt; ShortByteString
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-identifier hs-var hs-var hs-var hs-var">mappend</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; ShortByteString -&gt; ShortByteString
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">(&lt;&gt;)</span></a></span><span class="hs-cpp">
#else
</span><span>    </span><span class="hs-identifier">mappend</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">append</span><span class="hs-cpp">
#endif
</span><span>    </span><span id="local-6989586621679072075"><span class="annot"><span class="annottext">mconcat :: [ShortByteString] -&gt; ShortByteString
</span><a href="../../base/src/GHC.Base.html#mconcat"><span class="hs-identifier hs-var hs-var hs-var hs-var">mconcat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ShortByteString] -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span>
</span><span id="line-164"></span><span>
</span><span id="line-165"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#NFData"><span class="hs-identifier hs-type">NFData</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-166"></span><span>    </span><span id="local-6989586621679072070"><span class="annot"><span class="annottext">rnf :: ShortByteString -&gt; ()
</span><a href="../../deepseq/src/Control.DeepSeq.html#rnf"><span class="hs-identifier hs-var hs-var hs-var hs-var">rnf</span></a></span></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#SBS"><span class="hs-identifier hs-type">SBS</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679072064"><span id="local-6989586621679072066"><span class="annot"><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-type">Show</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-169"></span><span>    </span><span id="local-6989586621679072058"><span class="annot"><span class="annottext">showsPrec :: Int -&gt; ShortByteString -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showsPrec"><span class="hs-identifier hs-var hs-var hs-var hs-var">showsPrec</span></a></span></span><span> </span><span id="local-6989586621679072056"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679072056"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679072055"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679072055"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span id="local-6989586621679072054"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679072054"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; String -&gt; ShowS
forall a. Show a =&gt; Int -&gt; a -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#showsPrec"><span class="hs-identifier hs-var">showsPrec</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679072056"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; String
</span><a href="Data.ByteString.Short.Internal.html#unpackChars"><span class="hs-identifier hs-var">unpackChars</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679072055"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679072054"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-170"></span><span>
</span><span id="line-171"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679072046"><span id="local-6989586621679072048"><span id="local-6989586621679072050"><span class="annot"><a href="../../base/src/GHC.Read.html#Read"><span class="hs-identifier hs-type">Read</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-172"></span><span>    </span><span id="local-6989586621679072040"><span class="annot"><span class="annottext">readsPrec :: Int -&gt; ReadS ShortByteString
</span><a href="../../base/src/GHC.Read.html#readsPrec"><span class="hs-identifier hs-var hs-var hs-var hs-var">readsPrec</span></a></span></span><span> </span><span id="local-6989586621679072038"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679072038"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679072037"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679072037"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packChars"><span class="hs-identifier hs-var">packChars</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679072035"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679072034"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679072035"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679072035"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679072034"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679072034"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ReadS String
forall a. Read a =&gt; Int -&gt; ReadS a
</span><a href="../../base/src/GHC.Read.html#readsPrec"><span class="hs-identifier hs-var">readsPrec</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679072038"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679072037"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="hs-special">]</span><span class="hs-cpp">

#if MIN_VERSION_base(4,7,0)
</span><span class="hs-comment">-- | @since 0.10.12.0</span><span>
</span><span id="line-176"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679072031"><span class="annot"><a href="../../base/src/GHC.Exts.html#IsList"><span class="hs-identifier hs-type">GHC.Exts.IsList</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-177"></span><span>  </span><span class="hs-keyword">type</span><span> </span><span id="Item"><span class="annot"><a href="../../base/src/GHC.Exts.html#Item"><span class="hs-identifier hs-var">Item</span></a></span></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-178"></span><span>  </span><span id="local-6989586621679072028"><span class="annot"><span class="annottext">fromList :: [Item ShortByteString] -&gt; ShortByteString
</span><a href="../../base/src/GHC.Exts.html#fromList"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Word8] -&gt; ShortByteString
[Item ShortByteString] -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packBytes"><span class="hs-identifier hs-var">packBytes</span></a></span><span>
</span><span id="line-179"></span><span>  </span><span id="local-6989586621679072026"><span class="annot"><span class="annottext">toList :: ShortByteString -&gt; [Item ShortByteString]
</span><a href="../../base/src/GHC.Exts.html#toList"><span class="hs-identifier hs-var hs-var hs-var hs-var">toList</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; [Word8]
ShortByteString -&gt; [Item ShortByteString]
</span><a href="Data.ByteString.Short.Internal.html#unpackBytes"><span class="hs-identifier hs-var">unpackBytes</span></a></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-182"></span><span class="hs-comment">-- | Beware: 'fromString' truncates multi-byte characters to octets.</span><span>
</span><span id="line-183"></span><span class="hs-comment">-- e.g. &quot;&#26543;&#26422;&#12395;&#28879;&#12398;&#12392;&#12414;&#12426;&#12369;&#12426;&#31179;&#12398;&#26286;&quot; becomes &#65533;6k&#65533;nh~&#65533;Q&#65533;&#65533;n&#65533;</span><span>
</span><span id="line-184"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/Data.String.html#IsString"><span class="hs-identifier hs-type">IsString</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-185"></span><span>    </span><span id="local-6989586621679072021"><span class="annot"><span class="annottext">fromString :: String -&gt; ShortByteString
</span><a href="../../base/src/Data.String.html#fromString"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromString</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packChars"><span class="hs-identifier hs-var">packChars</span></a></span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679071995"><span id="local-6989586621679071997"><span id="local-6989586621679071999"><span id="local-6989586621679072001"><span id="local-6989586621679072003"><span id="local-6989586621679072005"><span id="local-6989586621679072007"><span id="local-6989586621679072009"><span id="local-6989586621679072011"><span id="local-6989586621679072013"><span class="annot"><a href="../../base/src/Data.Data.html#Data"><span class="hs-identifier hs-type">Data</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span></span></span></span></span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-188"></span><span>  </span><span id="local-6989586621679071989"><span class="annot"><span class="annottext">gfoldl :: forall (c :: * -&gt; *).
(forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b)
-&gt; (forall g. g -&gt; c g) -&gt; ShortByteString -&gt; c ShortByteString
</span><a href="../../base/src/Data.Data.html#gfoldl"><span class="hs-identifier hs-var hs-var hs-var hs-var">gfoldl</span></a></span></span><span> </span><span id="local-6989586621679071987"><span class="annot"><span class="annottext">forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b
</span><a href="#local-6989586621679071987"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679071986"><span class="annot"><span class="annottext">forall g. g -&gt; c g
</span><a href="#local-6989586621679071986"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679071985"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071985"><span class="hs-identifier hs-var">txt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Word8] -&gt; ShortByteString) -&gt; c ([Word8] -&gt; ShortByteString)
forall g. g -&gt; c g
</span><a href="#local-6989586621679071986"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">[Word8] -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packBytes"><span class="hs-identifier hs-var">packBytes</span></a></span><span> </span><span class="annot"><span class="annottext">c ([Word8] -&gt; ShortByteString) -&gt; [Word8] -&gt; c ShortByteString
forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b
</span><a href="#local-6989586621679071987"><span class="hs-operator hs-var">`f`</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; [Word8]
</span><a href="Data.ByteString.Short.Internal.html#unpackBytes"><span class="hs-identifier hs-var">unpackBytes</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071985"><span class="hs-identifier hs-var">txt</span></a></span><span>
</span><span id="line-189"></span><span>  </span><span id="local-6989586621679071982"><span class="annot"><span class="annottext">toConstr :: ShortByteString -&gt; Constr
</span><a href="../../base/src/Data.Data.html#toConstr"><span class="hs-identifier hs-var hs-var hs-var hs-var">toConstr</span></a></span></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><span class="hs-identifier">_</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Constr
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data.ByteString.Short.ShortByteString.toConstr&quot;</span></span><span>
</span><span id="line-190"></span><span>  </span><span id="local-6989586621679071978"><span class="annot"><span class="annottext">gunfold :: forall (c :: * -&gt; *).
(forall b r. Data b =&gt; c (b -&gt; r) -&gt; c r)
-&gt; (forall r. r -&gt; c r) -&gt; Constr -&gt; c ShortByteString
</span><a href="../../base/src/Data.Data.html#gunfold"><span class="hs-identifier hs-var hs-var hs-var hs-var">gunfold</span></a></span></span><span> </span><span class="annot"><span class="annottext">forall b r. Data b =&gt; c (b -&gt; r) -&gt; c r
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">forall r. r -&gt; c r
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Constr -&gt; c ShortByteString
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data.ByteString.Short.ShortByteString.gunfold&quot;</span></span><span>
</span><span id="line-191"></span><span>  </span><span id="local-6989586621679071976"><span class="annot"><span class="annottext">dataTypeOf :: ShortByteString -&gt; DataType
</span><a href="../../base/src/Data.Data.html#dataTypeOf"><span class="hs-identifier hs-var hs-var hs-var hs-var">dataTypeOf</span></a></span></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; DataType
</span><a href="../../base/src/Data.Data.html#mkNoRepType"><span class="hs-identifier hs-var">mkNoRepType</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data.ByteString.Short.ShortByteString&quot;</span></span><span>
</span><span id="line-192"></span><span>
</span><span id="line-193"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-194"></span><span class="hs-comment">-- Simple operations</span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span class="hs-comment">-- | /O(1)/. The empty 'ShortByteString'.</span><span>
</span><span id="line-197"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#empty"><span class="hs-identifier hs-type">empty</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-198"></span><span id="empty"><span class="annot"><span class="annottext">empty :: ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#empty"><span class="hs-identifier hs-var hs-var">empty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; (forall s. MBA s -&gt; ST s ()) -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#create"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">MBA s
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">() -&gt; ST s ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-199"></span><span>
</span><span id="line-200"></span><span class="hs-comment">-- | /O(1)/ The length of a 'ShortByteString'.</span><span>
</span><span id="line-201"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-type">length</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-cpp">
#if MIN_VERSION_base(4,3,0)
</span><span id="length"><span class="annot"><span class="annottext">length :: ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var hs-var">length</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#SBS"><span class="hs-identifier hs-type">SBS</span></a></span><span> </span><span id="local-6989586621679071971"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071971"><span class="hs-identifier hs-var">barr#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; Int
</span><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-var">I#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteArray# -&gt; Int#
</span><a href="../../ghc-prim/src/GHC.Prim.html#sizeofByteArray%23"><span class="hs-identifier hs-var">sizeofByteArray#</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071971"><span class="hs-identifier hs-var">barr#</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span class="hs-identifier">length</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">SBS</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">len</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">len</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-208"></span><span class="hs-comment">-- | /O(1)/ Test whether a 'ShortByteString' is empty.</span><span>
</span><span id="line-209"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#null"><span class="hs-identifier hs-type">null</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-210"></span><span id="null"><span class="annot"><span class="annottext">null :: ShortByteString -&gt; Bool
</span><a href="Data.ByteString.Short.Internal.html#null"><span class="hs-identifier hs-var hs-var">null</span></a></span></span><span> </span><span id="local-6989586621679071970"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071970"><span class="hs-identifier hs-var">sbs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071970"><span class="hs-identifier hs-var">sbs</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span class="hs-comment">-- | /O(1)/ 'ShortByteString' index (subscript) operator, starting from 0.</span><span>
</span><span id="line-213"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#index"><span class="hs-identifier hs-type">index</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-214"></span><span id="index"><span class="annot"><span class="annottext">index :: ShortByteString -&gt; Int -&gt; Word8
</span><a href="Data.ByteString.Short.Internal.html#index"><span class="hs-identifier hs-var hs-var">index</span></a></span></span><span> </span><span id="local-6989586621679071969"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071969"><span class="hs-identifier hs-var">sbs</span></a></span></span><span> </span><span id="local-6989586621679071968"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071968"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-215"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071968"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071968"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071969"><span class="hs-identifier hs-var">sbs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int -&gt; Word8
</span><a href="Data.ByteString.Short.Internal.html#unsafeIndex"><span class="hs-identifier hs-var">unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071969"><span class="hs-identifier hs-var">sbs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071968"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-216"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int -&gt; Word8
forall a. ShortByteString -&gt; Int -&gt; a
</span><a href="Data.ByteString.Short.Internal.html#indexError"><span class="hs-identifier hs-var">indexError</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071969"><span class="hs-identifier hs-var">sbs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071968"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#unsafeIndex"><span class="hs-identifier hs-type">unsafeIndex</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-219"></span><span id="unsafeIndex"><span class="annot"><span class="annottext">unsafeIndex :: ShortByteString -&gt; Int -&gt; Word8
</span><a href="Data.ByteString.Short.Internal.html#unsafeIndex"><span class="hs-identifier hs-var hs-var">unsafeIndex</span></a></span></span><span> </span><span id="local-6989586621679071965"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071965"><span class="hs-identifier hs-var">sbs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BA -&gt; Int -&gt; Word8
</span><a href="Data.ByteString.Short.Internal.html#indexWord8Array"><span class="hs-identifier hs-var">indexWord8Array</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071965"><span class="hs-identifier hs-var">sbs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span>
</span><span id="line-221"></span><span id="local-6989586621679072352"><span class="annot"><a href="Data.ByteString.Short.Internal.html#indexError"><span class="hs-identifier hs-type">indexError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679072352"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-222"></span><span id="indexError"><span class="annot"><span class="annottext">indexError :: forall a. ShortByteString -&gt; Int -&gt; a
</span><a href="Data.ByteString.Short.Internal.html#indexError"><span class="hs-identifier hs-var hs-var">indexError</span></a></span></span><span> </span><span id="local-6989586621679071958"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071958"><span class="hs-identifier hs-var">sbs</span></a></span></span><span> </span><span id="local-6989586621679071957"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071957"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-223"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; a
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; a) -&gt; String -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data.ByteString.Short.index: error in array index; &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071957"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-224"></span><span>       </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; not in range [0..&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071958"><span class="hs-identifier hs-var">sbs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;)&quot;</span></span><span>
</span><span id="line-225"></span><span>
</span><span id="line-226"></span><span>
</span><span id="line-227"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-228"></span><span class="hs-comment">-- Internal utils</span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-type">asBA</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA"><span class="hs-identifier hs-type">BA</span></a></span><span>
</span><span id="line-231"></span><span id="asBA"><span class="annot"><span class="annottext">asBA :: ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var hs-var">asBA</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#SBS"><span class="hs-identifier hs-type">SBS</span></a></span><span> </span><span id="local-6989586621679071955"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071955"><span class="hs-identifier hs-var">ba#</span></a></span></span><span> </span><span class="hs-identifier">_len</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">BA#</span><span> </span><span class="hs-identifier">ba#</span><span>
</span><span id="line-232"></span><span>
</span><span id="line-233"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#create"><span class="hs-identifier hs-type">create</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679072359"><span class="annot"><a href="#local-6989586621679072359"><span class="hs-identifier hs-type">s</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-type">MBA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072359"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072359"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-234"></span><span id="create"><span class="annot"><span class="annottext">create :: Int -&gt; (forall s. MBA s -&gt; ST s ()) -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#create"><span class="hs-identifier hs-var hs-var">create</span></a></span></span><span> </span><span id="local-6989586621679071953"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071953"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span id="local-6989586621679071952"><span class="annot"><span class="annottext">forall s. MBA s -&gt; ST s ()
</span><a href="#local-6989586621679071952"><span class="hs-identifier hs-var">fill</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-235"></span><span>    </span><span class="annot"><span class="annottext">(forall s. ST s ShortByteString) -&gt; ShortByteString
forall a. (forall s. ST s a) -&gt; a
</span><a href="../../base/src/GHC.ST.html#runST"><span class="hs-identifier hs-var">runST</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">do</span><span>
</span><span id="line-236"></span><span>      </span><span id="local-6989586621679071947"><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071947"><span class="hs-identifier hs-var">mba</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST s (MBA s)
forall s. Int -&gt; ST s (MBA s)
</span><a href="Data.ByteString.Short.Internal.html#newByteArray"><span class="hs-identifier hs-var">newByteArray</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071953"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-237"></span><span>      </span><span class="annot"><span class="annottext">MBA s -&gt; ST s ()
forall s. MBA s -&gt; ST s ()
</span><a href="#local-6989586621679071952"><span class="hs-identifier hs-var">fill</span></a></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071947"><span class="hs-identifier hs-var">mba</span></a></span><span>
</span><span id="line-238"></span><span>      </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA%23"><span class="hs-identifier hs-type">BA#</span></a></span><span> </span><span id="local-6989586621679071945"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071945"><span class="hs-identifier hs-var">ba#</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">MBA s -&gt; ST s BA
forall s. MBA s -&gt; ST s BA
</span><a href="Data.ByteString.Short.Internal.html#unsafeFreezeByteArray"><span class="hs-identifier hs-var">unsafeFreezeByteArray</span></a></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071947"><span class="hs-identifier hs-var">mba</span></a></span><span>
</span><span id="line-239"></span><span>      </span><span class="annot"><span class="annottext">ShortByteString -&gt; ST s ShortByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteArray# -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#SBS"><span class="hs-identifier hs-var">SBS</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071945"><span class="hs-identifier hs-var">ba#</span></a></span><span> </span><span class="hs-identifier">LEN</span><span class="hs-special">(</span><span class="hs-identifier">len</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-240"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#create"><span class="hs-pragma hs-type">create</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-241"></span><span>
</span><span id="line-242"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-243"></span><span class="hs-comment">-- Conversion to and from ByteString</span><span>
</span><span id="line-244"></span><span>
</span><span id="line-245"></span><span class="hs-comment">-- | /O(n)/. Convert a 'ByteString' into a 'ShortByteString'.</span><span>
</span><span id="line-246"></span><span class="hs-comment">--</span><span>
</span><span id="line-247"></span><span class="hs-comment">-- This makes a copy, so does not retain the input string.</span><span>
</span><span id="line-248"></span><span class="hs-comment">--</span><span>
</span><span id="line-249"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#toShort"><span class="hs-identifier hs-type">toShort</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-250"></span><span id="toShort"><span class="annot"><span class="annottext">toShort :: ByteString -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#toShort"><span class="hs-identifier hs-var hs-var">toShort</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071943"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679071943"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO ShortByteString -&gt; ShortByteString
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafeDupablePerformIO"><span class="hs-identifier hs-var">unsafeDupablePerformIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; IO ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#toShortIO"><span class="hs-identifier hs-var">toShortIO</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679071943"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-251"></span><span>
</span><span id="line-252"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#toShortIO"><span class="hs-identifier hs-type">toShortIO</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-253"></span><span id="toShortIO"><span class="annot"><span class="annottext">toShortIO :: ByteString -&gt; IO ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#toShortIO"><span class="hs-identifier hs-var hs-var">toShortIO</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-type">PS</span></a></span><span> </span><span id="local-6989586621679071939"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679071939"><span class="hs-identifier hs-var">fptr</span></a></span></span><span> </span><span id="local-6989586621679071938"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071938"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679071937"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071937"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-254"></span><span>    </span><span id="local-6989586621679071936"><span class="annot"><span class="annottext">MBA RealWorld
</span><a href="#local-6989586621679071936"><span class="hs-identifier hs-var">mba</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ST RealWorld (MBA RealWorld) -&gt; IO (MBA RealWorld)
forall a. ST RealWorld a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#stToIO"><span class="hs-identifier hs-var">stToIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ST RealWorld (MBA RealWorld)
forall s. Int -&gt; ST s (MBA s)
</span><a href="Data.ByteString.Short.Internal.html#newByteArray"><span class="hs-identifier hs-var">newByteArray</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071937"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-255"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679071934"><span class="annot"><span class="annottext">ptr :: Ptr Word8
</span><a href="#local-6989586621679071934"><span class="hs-identifier hs-var hs-var">ptr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; Ptr Word8
forall a. ForeignPtr a -&gt; Ptr a
</span><a href="../../base/src/GHC.ForeignPtr.html#unsafeForeignPtrToPtr"><span class="hs-identifier hs-var">unsafeForeignPtrToPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679071939"><span class="hs-identifier hs-var">fptr</span></a></span><span>
</span><span id="line-256"></span><span>    </span><span class="annot"><span class="annottext">ST RealWorld () -&gt; IO ()
forall a. ST RealWorld a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#stToIO"><span class="hs-identifier hs-var">stToIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Any -&gt; MBA RealWorld -&gt; Int -&gt; Int -&gt; ST RealWorld ()
forall a. Ptr a -&gt; MBA RealWorld -&gt; Int -&gt; Int -&gt; ST RealWorld ()
</span><a href="Data.ByteString.Short.Internal.html#copyAddrToByteArray"><span class="hs-identifier hs-var">copyAddrToByteArray</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679071934"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Ptr Any
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071938"><span class="hs-identifier hs-var">off</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MBA RealWorld
</span><a href="#local-6989586621679071936"><span class="hs-identifier hs-var">mba</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071937"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-257"></span><span>    </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; IO ()
forall a. ForeignPtr a -&gt; IO ()
</span><a href="../../base/src/GHC.ForeignPtr.html#touchForeignPtr"><span class="hs-identifier hs-var">touchForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679071939"><span class="hs-identifier hs-var">fptr</span></a></span><span>
</span><span id="line-258"></span><span>    </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA%23"><span class="hs-identifier hs-type">BA#</span></a></span><span> </span><span id="local-6989586621679071931"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071931"><span class="hs-identifier hs-var">ba#</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ST RealWorld BA -&gt; IO BA
forall a. ST RealWorld a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#stToIO"><span class="hs-identifier hs-var">stToIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MBA RealWorld -&gt; ST RealWorld BA
forall s. MBA s -&gt; ST s BA
</span><a href="Data.ByteString.Short.Internal.html#unsafeFreezeByteArray"><span class="hs-identifier hs-var">unsafeFreezeByteArray</span></a></span><span> </span><span class="annot"><span class="annottext">MBA RealWorld
</span><a href="#local-6989586621679071936"><span class="hs-identifier hs-var">mba</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-259"></span><span>    </span><span class="annot"><span class="annottext">ShortByteString -&gt; IO ShortByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteArray# -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#SBS"><span class="hs-identifier hs-var">SBS</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071931"><span class="hs-identifier hs-var">ba#</span></a></span><span> </span><span class="hs-identifier">LEN</span><span class="hs-special">(</span><span class="hs-identifier">len</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-260"></span><span>
</span><span id="line-261"></span><span>
</span><span id="line-262"></span><span class="hs-comment">-- | /O(n)/. Convert a 'ShortByteString' into a 'ByteString'.</span><span>
</span><span id="line-263"></span><span class="hs-comment">--</span><span>
</span><span id="line-264"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#fromShort"><span class="hs-identifier hs-type">fromShort</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-265"></span><span id="fromShort"><span class="annot"><span class="annottext">fromShort :: ShortByteString -&gt; ByteString
</span><a href="Data.ByteString.Short.Internal.html#fromShort"><span class="hs-identifier hs-var hs-var">fromShort</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071930"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071930"><span class="hs-identifier hs-var">sbs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO ByteString -&gt; ByteString
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafeDupablePerformIO"><span class="hs-identifier hs-var">unsafeDupablePerformIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; IO ByteString
</span><a href="Data.ByteString.Short.Internal.html#fromShortIO"><span class="hs-identifier hs-var">fromShortIO</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071930"><span class="hs-identifier hs-var">sbs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-266"></span><span>
</span><span id="line-267"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#fromShortIO"><span class="hs-identifier hs-type">fromShortIO</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-268"></span><span id="fromShortIO"><span class="annot"><span class="annottext">fromShortIO :: ShortByteString -&gt; IO ByteString
</span><a href="Data.ByteString.Short.Internal.html#fromShortIO"><span class="hs-identifier hs-var hs-var">fromShortIO</span></a></span></span><span> </span><span id="local-6989586621679071928"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071928"><span class="hs-identifier hs-var">sbs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span class="hs-cpp">
#if MIN_VERSION_base(4,6,0)
</span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679071927"><span class="annot"><span class="annottext">len :: Int
</span><a href="#local-6989586621679071927"><span class="hs-identifier hs-var hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071928"><span class="hs-identifier hs-var">sbs</span></a></span><span>
</span><span id="line-271"></span><span>    </span><span id="local-6989586621679071926"><span class="annot"><span class="annottext">mba :: MBA RealWorld
</span><a href="#local-6989586621679071926"><span class="hs-identifier hs-var">mba</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA%23"><span class="hs-identifier hs-type">MBA#</span></a></span><span> </span><span id="local-6989586621679071924"><span class="annot"><span class="annottext">MutableByteArray# RealWorld
</span><a href="#local-6989586621679071924"><span class="hs-identifier hs-var">mba#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ST RealWorld (MBA RealWorld) -&gt; IO (MBA RealWorld)
forall a. ST RealWorld a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#stToIO"><span class="hs-identifier hs-var">stToIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ST RealWorld (MBA RealWorld)
forall s. Int -&gt; ST s (MBA s)
</span><a href="Data.ByteString.Short.Internal.html#newPinnedByteArray"><span class="hs-identifier hs-var">newPinnedByteArray</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071927"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-272"></span><span>    </span><span class="annot"><span class="annottext">ST RealWorld () -&gt; IO ()
forall a. ST RealWorld a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#stToIO"><span class="hs-identifier hs-var">stToIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BA -&gt; Int -&gt; MBA RealWorld -&gt; Int -&gt; Int -&gt; ST RealWorld ()
forall s. BA -&gt; Int -&gt; MBA s -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.ByteString.Short.Internal.html#copyByteArray"><span class="hs-identifier hs-var">copyByteArray</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071928"><span class="hs-identifier hs-var">sbs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">MBA RealWorld
</span><a href="#local-6989586621679071926"><span class="hs-identifier hs-var">mba</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071927"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-273"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679071921"><span class="annot"><span class="annottext">fp :: ForeignPtr Word8
</span><a href="#local-6989586621679071921"><span class="hs-identifier hs-var hs-var">fp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Addr# -&gt; ForeignPtrContents -&gt; ForeignPtr Word8
forall a. Addr# -&gt; ForeignPtrContents -&gt; ForeignPtr a
</span><a href="../../base/src/GHC.ForeignPtr.html#ForeignPtr"><span class="hs-identifier hs-var">ForeignPtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteArray# -&gt; Addr#
</span><a href="../../ghc-prim/src/GHC.Prim.html#byteArrayContents%23"><span class="hs-identifier hs-var">byteArrayContents#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MutableByteArray# RealWorld -&gt; ByteArray#
</span><a href="../../base/src/Unsafe.Coerce.html#unsafeCoerce%23"><span class="hs-identifier hs-var">unsafeCoerce#</span></a></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# RealWorld
</span><a href="#local-6989586621679071924"><span class="hs-identifier hs-var">mba#</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-274"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MutableByteArray# RealWorld -&gt; ForeignPtrContents
</span><a href="../../base/src/GHC.ForeignPtr.html#PlainPtr"><span class="hs-identifier hs-var">PlainPtr</span></a></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# RealWorld
</span><a href="#local-6989586621679071924"><span class="hs-identifier hs-var">mba#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-275"></span><span>    </span><span class="annot"><span class="annottext">ByteString -&gt; IO ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; Int -&gt; Int -&gt; ByteString
</span><a href="Data.ByteString.Internal.html#PS"><span class="hs-identifier hs-var">PS</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679071921"><span class="hs-identifier hs-var">fp</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071927"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span>    </span><span class="hs-comment">-- Before base 4.6 ForeignPtrContents is not exported from GHC.ForeignPtr</span><span>
</span><span id="line-278"></span><span>    </span><span class="hs-comment">-- so we cannot get direct access to the mbarr#</span><span>
</span><span id="line-279"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">len</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">length</span><span> </span><span class="hs-identifier">sbs</span><span>
</span><span id="line-280"></span><span>    </span><span class="hs-identifier">fptr</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">mallocPlainForeignPtrBytes</span><span> </span><span class="hs-identifier">len</span><span>
</span><span id="line-281"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">ptr</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">unsafeForeignPtrToPtr</span><span> </span><span class="hs-identifier">fptr</span><span>
</span><span id="line-282"></span><span>    </span><span class="hs-identifier">stToIO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">copyByteArrayToAddr</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">asBA</span><span> </span><span class="hs-identifier">sbs</span><span class="hs-special">)</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">ptr</span><span> </span><span class="hs-identifier">len</span><span class="hs-special">)</span><span>
</span><span id="line-283"></span><span>    </span><span class="hs-identifier">touchForeignPtr</span><span> </span><span class="hs-identifier">fptr</span><span>
</span><span id="line-284"></span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">PS</span><span> </span><span class="hs-identifier">fptr</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">len</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-287"></span><span>
</span><span id="line-288"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-289"></span><span class="hs-comment">-- Packing and unpacking from lists</span><span>
</span><span id="line-290"></span><span>
</span><span id="line-291"></span><span class="hs-comment">-- | /O(n)/. Convert a list into a 'ShortByteString'</span><span>
</span><span id="line-292"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#pack"><span class="hs-identifier hs-type">pack</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-293"></span><span id="pack"><span class="annot"><span class="annottext">pack :: [Word8] -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#pack"><span class="hs-identifier hs-var hs-var">pack</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Word8] -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packBytes"><span class="hs-identifier hs-var">packBytes</span></a></span><span>
</span><span id="line-294"></span><span>
</span><span id="line-295"></span><span class="hs-comment">-- | /O(n)/. Convert a 'ShortByteString' into a list.</span><span>
</span><span id="line-296"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#unpack"><span class="hs-identifier hs-type">unpack</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-297"></span><span id="unpack"><span class="annot"><span class="annottext">unpack :: ShortByteString -&gt; [Word8]
</span><a href="Data.ByteString.Short.Internal.html#unpack"><span class="hs-identifier hs-var hs-var">unpack</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; [Word8]
</span><a href="Data.ByteString.Short.Internal.html#unpackBytes"><span class="hs-identifier hs-var">unpackBytes</span></a></span><span>
</span><span id="line-298"></span><span>
</span><span id="line-299"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#packChars"><span class="hs-identifier hs-type">packChars</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-300"></span><span id="packChars"><span class="annot"><span class="annottext">packChars :: String -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packChars"><span class="hs-identifier hs-var hs-var">packChars</span></a></span></span><span> </span><span id="local-6989586621679071920"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071920"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; String -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packLenChars"><span class="hs-identifier hs-var">packLenChars</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">List.length</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071920"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071920"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-301"></span><span>
</span><span id="line-302"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#packBytes"><span class="hs-identifier hs-type">packBytes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-303"></span><span id="packBytes"><span class="annot"><span class="annottext">packBytes :: [Word8] -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packBytes"><span class="hs-identifier hs-var hs-var">packBytes</span></a></span></span><span> </span><span id="local-6989586621679071918"><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071918"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Word8] -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packLenBytes"><span class="hs-identifier hs-var">packLenBytes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Word8] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">List.length</span></a></span><span> </span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071918"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071918"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-304"></span><span>
</span><span id="line-305"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#packLenChars"><span class="hs-identifier hs-type">packLenChars</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-306"></span><span id="packLenChars"><span class="annot"><span class="annottext">packLenChars :: Int -&gt; String -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packLenChars"><span class="hs-identifier hs-var hs-var">packLenChars</span></a></span></span><span> </span><span id="local-6989586621679071916"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071916"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span id="local-6989586621679071915"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071915"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-307"></span><span>    </span><span class="annot"><span class="annottext">Int -&gt; (forall s. MBA s -&gt; ST s ()) -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#create"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071916"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679071914"><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071914"><span class="hs-identifier hs-var">mba</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MBA s -&gt; Int -&gt; String -&gt; ST s ()
forall s. MBA s -&gt; Int -&gt; String -&gt; ST s ()
</span><a href="#local-6989586621679071913"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071914"><span class="hs-identifier hs-var">mba</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071915"><span class="hs-identifier hs-var">cs0</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-308"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-309"></span><span>    </span><span id="local-6989586621679072321"><span class="annot"><a href="#local-6989586621679071913"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-type">MBA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072321"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072321"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-310"></span><span>    </span><span id="local-6989586621679071913"><span class="annot"><span class="annottext">go :: forall s. MBA s -&gt; Int -&gt; String -&gt; ST s ()
</span><a href="#local-6989586621679071913"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">MBA s
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; ST s ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-311"></span><span>    </span><span class="annot"><a href="#local-6989586621679071913"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071908"><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071908"><span class="hs-identifier hs-var">mba</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071907"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071907"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679071906"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679071906"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679071905"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071905"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-312"></span><span>      </span><span class="annot"><span class="annottext">MBA s -&gt; Int -&gt; Char -&gt; ST s ()
forall s. MBA s -&gt; Int -&gt; Char -&gt; ST s ()
</span><a href="Data.ByteString.Short.Internal.html#writeCharArray"><span class="hs-identifier hs-var">writeCharArray</span></a></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071908"><span class="hs-identifier hs-var">mba</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071907"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679071906"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-313"></span><span>      </span><span class="annot"><span class="annottext">MBA s -&gt; Int -&gt; String -&gt; ST s ()
forall s. MBA s -&gt; Int -&gt; String -&gt; ST s ()
</span><a href="#local-6989586621679071913"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071908"><span class="hs-identifier hs-var">mba</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071907"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071905"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-314"></span><span>
</span><span id="line-315"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#packLenBytes"><span class="hs-identifier hs-type">packLenBytes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-316"></span><span id="packLenBytes"><span class="annot"><span class="annottext">packLenBytes :: Int -&gt; [Word8] -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packLenBytes"><span class="hs-identifier hs-var hs-var">packLenBytes</span></a></span></span><span> </span><span id="local-6989586621679071903"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071903"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span id="local-6989586621679071902"><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071902"><span class="hs-identifier hs-var">ws0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-317"></span><span>    </span><span class="annot"><span class="annottext">Int -&gt; (forall s. MBA s -&gt; ST s ()) -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#create"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071903"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679071901"><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071901"><span class="hs-identifier hs-var">mba</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MBA s -&gt; Int -&gt; [Word8] -&gt; ST s ()
forall s. MBA s -&gt; Int -&gt; [Word8] -&gt; ST s ()
</span><a href="#local-6989586621679071900"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071901"><span class="hs-identifier hs-var">mba</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071902"><span class="hs-identifier hs-var">ws0</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-318"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-319"></span><span>    </span><span id="local-6989586621679072316"><span class="annot"><a href="#local-6989586621679071900"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-type">MBA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072316"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072316"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-320"></span><span>    </span><span id="local-6989586621679071900"><span class="annot"><span class="annottext">go :: forall s. MBA s -&gt; Int -&gt; [Word8] -&gt; ST s ()
</span><a href="#local-6989586621679071900"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">MBA s
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; ST s ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-321"></span><span>    </span><span class="annot"><a href="#local-6989586621679071900"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071895"><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071895"><span class="hs-identifier hs-var">mba</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071894"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071894"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679071893"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679071893"><span class="hs-identifier hs-var">w</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679071892"><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071892"><span class="hs-identifier hs-var">ws</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-322"></span><span>      </span><span class="annot"><span class="annottext">MBA s -&gt; Int -&gt; Word8 -&gt; ST s ()
forall s. MBA s -&gt; Int -&gt; Word8 -&gt; ST s ()
</span><a href="Data.ByteString.Short.Internal.html#writeWord8Array"><span class="hs-identifier hs-var">writeWord8Array</span></a></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071895"><span class="hs-identifier hs-var">mba</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071894"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679071893"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-323"></span><span>      </span><span class="annot"><span class="annottext">MBA s -&gt; Int -&gt; [Word8] -&gt; ST s ()
forall s. MBA s -&gt; Int -&gt; [Word8] -&gt; ST s ()
</span><a href="#local-6989586621679071900"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071895"><span class="hs-identifier hs-var">mba</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071894"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071892"><span class="hs-identifier hs-var">ws</span></a></span><span>
</span><span id="line-324"></span><span>
</span><span id="line-325"></span><span class="hs-comment">-- Unpacking bytestrings into lists effeciently is a tradeoff: on the one hand</span><span>
</span><span id="line-326"></span><span class="hs-comment">-- we would like to write a tight loop that just blats the list into memory, on</span><span>
</span><span id="line-327"></span><span class="hs-comment">-- the other hand we want it to be unpacked lazily so we don't end up with a</span><span>
</span><span id="line-328"></span><span class="hs-comment">-- massive list data structure in memory.</span><span>
</span><span id="line-329"></span><span class="hs-comment">--</span><span>
</span><span id="line-330"></span><span class="hs-comment">-- Our strategy is to combine both: we will unpack lazily in reasonable sized</span><span>
</span><span id="line-331"></span><span class="hs-comment">-- chunks, where each chunk is unpacked strictly.</span><span>
</span><span id="line-332"></span><span class="hs-comment">--</span><span>
</span><span id="line-333"></span><span class="hs-comment">-- unpackChars does the lazy loop, while unpackAppendBytes and</span><span>
</span><span id="line-334"></span><span class="hs-comment">-- unpackAppendChars do the chunks strictly.</span><span>
</span><span id="line-335"></span><span>
</span><span id="line-336"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#unpackChars"><span class="hs-identifier hs-type">unpackChars</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-337"></span><span id="unpackChars"><span class="annot"><span class="annottext">unpackChars :: ShortByteString -&gt; String
</span><a href="Data.ByteString.Short.Internal.html#unpackChars"><span class="hs-identifier hs-var hs-var">unpackChars</span></a></span></span><span> </span><span id="local-6989586621679071890"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071890"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; ShowS
</span><a href="Data.ByteString.Short.Internal.html#unpackAppendCharsLazy"><span class="hs-identifier hs-var">unpackAppendCharsLazy</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071890"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-338"></span><span>
</span><span id="line-339"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#unpackBytes"><span class="hs-identifier hs-type">unpackBytes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-340"></span><span id="unpackBytes"><span class="annot"><span class="annottext">unpackBytes :: ShortByteString -&gt; [Word8]
</span><a href="Data.ByteString.Short.Internal.html#unpackBytes"><span class="hs-identifier hs-var hs-var">unpackBytes</span></a></span></span><span> </span><span id="local-6989586621679071888"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071888"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; [Word8] -&gt; [Word8]
</span><a href="Data.ByteString.Short.Internal.html#unpackAppendBytesLazy"><span class="hs-identifier hs-var">unpackAppendBytesLazy</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071888"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-341"></span><span>
</span><span id="line-342"></span><span class="hs-comment">-- Why 100 bytes you ask? Because on a 64bit machine the list we allocate</span><span>
</span><span id="line-343"></span><span class="hs-comment">-- takes just shy of 4k which seems like a reasonable amount.</span><span>
</span><span id="line-344"></span><span class="hs-comment">-- (5 words per list element, 8 bytes per word, 100 elements = 4000 bytes)</span><span>
</span><span id="line-345"></span><span>
</span><span id="line-346"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#unpackAppendCharsLazy"><span class="hs-identifier hs-type">unpackAppendCharsLazy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-347"></span><span id="unpackAppendCharsLazy"><span class="annot"><span class="annottext">unpackAppendCharsLazy :: ShortByteString -&gt; ShowS
</span><a href="Data.ByteString.Short.Internal.html#unpackAppendCharsLazy"><span class="hs-identifier hs-var hs-var">unpackAppendCharsLazy</span></a></span></span><span> </span><span id="local-6989586621679071886"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071886"><span class="hs-identifier hs-var">sbs</span></a></span></span><span> </span><span id="local-6989586621679071885"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071885"><span class="hs-identifier hs-var">cs0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; ShowS
</span><a href="#local-6989586621679071884"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071886"><span class="hs-identifier hs-var">sbs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071885"><span class="hs-identifier hs-var">cs0</span></a></span><span>
</span><span id="line-348"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-349"></span><span>    </span><span id="local-6989586621679071882"><span class="annot"><span class="annottext">sz :: Int
</span><a href="#local-6989586621679071882"><span class="hs-identifier hs-var hs-var">sz</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">100</span></span><span>
</span><span id="line-350"></span><span>
</span><span id="line-351"></span><span>    </span><span id="local-6989586621679071884"><span class="annot"><span class="annottext">go :: Int -&gt; Int -&gt; ShowS
</span><a href="#local-6989586621679071884"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679071881"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071881"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679071880"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071880"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span id="local-6989586621679071879"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071879"><span class="hs-identifier hs-var">cs</span></a></span></span><span>
</span><span id="line-352"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071880"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071882"><span class="hs-identifier hs-var">sz</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int -&gt; Int -&gt; ShowS
</span><a href="Data.ByteString.Short.Internal.html#unpackAppendCharsStrict"><span class="hs-identifier hs-var">unpackAppendCharsStrict</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071886"><span class="hs-identifier hs-var">sbs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071881"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071880"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071879"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-353"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int -&gt; Int -&gt; ShowS
</span><a href="Data.ByteString.Short.Internal.html#unpackAppendCharsStrict"><span class="hs-identifier hs-var">unpackAppendCharsStrict</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071886"><span class="hs-identifier hs-var">sbs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071881"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071882"><span class="hs-identifier hs-var">sz</span></a></span><span>  </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071876"><span class="hs-identifier hs-var">remainder</span></a></span><span>
</span><span id="line-354"></span><span>                      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679071876"><span class="annot"><span class="annottext">remainder :: String
</span><a href="#local-6989586621679071876"><span class="hs-identifier hs-var hs-var">remainder</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; ShowS
</span><a href="#local-6989586621679071884"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071881"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071882"><span class="hs-identifier hs-var">sz</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071880"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071882"><span class="hs-identifier hs-var">sz</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071879"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-355"></span><span>
</span><span id="line-356"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#unpackAppendBytesLazy"><span class="hs-identifier hs-type">unpackAppendBytesLazy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-357"></span><span id="unpackAppendBytesLazy"><span class="annot"><span class="annottext">unpackAppendBytesLazy :: ShortByteString -&gt; [Word8] -&gt; [Word8]
</span><a href="Data.ByteString.Short.Internal.html#unpackAppendBytesLazy"><span class="hs-identifier hs-var hs-var">unpackAppendBytesLazy</span></a></span></span><span> </span><span id="local-6989586621679071875"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071875"><span class="hs-identifier hs-var">sbs</span></a></span></span><span> </span><span id="local-6989586621679071874"><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071874"><span class="hs-identifier hs-var">ws0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Word8] -&gt; [Word8]
</span><a href="#local-6989586621679071873"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071875"><span class="hs-identifier hs-var">sbs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071874"><span class="hs-identifier hs-var">ws0</span></a></span><span>
</span><span id="line-358"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-359"></span><span>    </span><span id="local-6989586621679071871"><span class="annot"><span class="annottext">sz :: Int
</span><a href="#local-6989586621679071871"><span class="hs-identifier hs-var hs-var">sz</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">100</span></span><span>
</span><span id="line-360"></span><span>
</span><span id="line-361"></span><span>    </span><span id="local-6989586621679071873"><span class="annot"><span class="annottext">go :: Int -&gt; Int -&gt; [Word8] -&gt; [Word8]
</span><a href="#local-6989586621679071873"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679071870"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071870"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679071869"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071869"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span id="local-6989586621679071868"><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071868"><span class="hs-identifier hs-var">ws</span></a></span></span><span>
</span><span id="line-362"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071869"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071871"><span class="hs-identifier hs-var">sz</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int -&gt; Int -&gt; [Word8] -&gt; [Word8]
</span><a href="Data.ByteString.Short.Internal.html#unpackAppendBytesStrict"><span class="hs-identifier hs-var">unpackAppendBytesStrict</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071875"><span class="hs-identifier hs-var">sbs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071870"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071869"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071868"><span class="hs-identifier hs-var">ws</span></a></span><span>
</span><span id="line-363"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int -&gt; Int -&gt; [Word8] -&gt; [Word8]
</span><a href="Data.ByteString.Short.Internal.html#unpackAppendBytesStrict"><span class="hs-identifier hs-var">unpackAppendBytesStrict</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071875"><span class="hs-identifier hs-var">sbs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071870"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071871"><span class="hs-identifier hs-var">sz</span></a></span><span>  </span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071866"><span class="hs-identifier hs-var">remainder</span></a></span><span>
</span><span id="line-364"></span><span>                      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679071866"><span class="annot"><span class="annottext">remainder :: [Word8]
</span><a href="#local-6989586621679071866"><span class="hs-identifier hs-var hs-var">remainder</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Word8] -&gt; [Word8]
</span><a href="#local-6989586621679071873"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071870"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071871"><span class="hs-identifier hs-var">sz</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071869"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071871"><span class="hs-identifier hs-var">sz</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071868"><span class="hs-identifier hs-var">ws</span></a></span><span>
</span><span id="line-365"></span><span>
</span><span id="line-366"></span><span class="hs-comment">-- For these unpack functions, since we're unpacking the whole list strictly we</span><span>
</span><span id="line-367"></span><span class="hs-comment">-- build up the result list in an accumulator. This means we have to build up</span><span>
</span><span id="line-368"></span><span class="hs-comment">-- the list starting at the end. So our traversal starts at the end of the</span><span>
</span><span id="line-369"></span><span class="hs-comment">-- buffer and loops down until we hit the sentinal:</span><span>
</span><span id="line-370"></span><span>
</span><span id="line-371"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#unpackAppendCharsStrict"><span class="hs-identifier hs-type">unpackAppendCharsStrict</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-372"></span><span id="unpackAppendCharsStrict"><span class="annot"><span class="annottext">unpackAppendCharsStrict :: ShortByteString -&gt; Int -&gt; Int -&gt; ShowS
</span><a href="Data.ByteString.Short.Internal.html#unpackAppendCharsStrict"><span class="hs-identifier hs-var hs-var">unpackAppendCharsStrict</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071865"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071865"><span class="hs-identifier hs-var">sbs</span></a></span></span><span> </span><span id="local-6989586621679071864"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071864"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679071863"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071863"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span id="local-6989586621679071862"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071862"><span class="hs-identifier hs-var">cs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; ShowS
</span><a href="#local-6989586621679071861"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071864"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071864"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071863"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071862"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-373"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-374"></span><span>    </span><span id="local-6989586621679071861"><span class="annot"><span class="annottext">go :: Int -&gt; Int -&gt; ShowS
</span><a href="#local-6989586621679071861"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071860"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071860"><span class="hs-identifier hs-var">sentinal</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071859"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071859"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071858"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071858"><span class="hs-identifier hs-var">acc</span></a></span></span><span>
</span><span id="line-375"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071859"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071860"><span class="hs-identifier hs-var">sentinal</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071858"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-376"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071857"><span class="annot"><span class="annottext">c :: Char
</span><a href="#local-6989586621679071857"><span class="hs-identifier hs-var hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BA -&gt; Int -&gt; Char
</span><a href="Data.ByteString.Short.Internal.html#indexCharArray"><span class="hs-identifier hs-var">indexCharArray</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071865"><span class="hs-identifier hs-var">sbs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071859"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-377"></span><span>                        </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; ShowS
</span><a href="#local-6989586621679071861"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071860"><span class="hs-identifier hs-var">sentinal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071859"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679071857"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">Char -&gt; ShowS
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071858"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-378"></span><span>
</span><span id="line-379"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#unpackAppendBytesStrict"><span class="hs-identifier hs-type">unpackAppendBytesStrict</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-380"></span><span id="unpackAppendBytesStrict"><span class="annot"><span class="annottext">unpackAppendBytesStrict :: ShortByteString -&gt; Int -&gt; Int -&gt; [Word8] -&gt; [Word8]
</span><a href="Data.ByteString.Short.Internal.html#unpackAppendBytesStrict"><span class="hs-identifier hs-var hs-var">unpackAppendBytesStrict</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071855"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071855"><span class="hs-identifier hs-var">sbs</span></a></span></span><span> </span><span id="local-6989586621679071854"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071854"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679071853"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071853"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span id="local-6989586621679071852"><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071852"><span class="hs-identifier hs-var">ws</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Word8] -&gt; [Word8]
</span><a href="#local-6989586621679071851"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071854"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071854"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071853"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071852"><span class="hs-identifier hs-var">ws</span></a></span><span>
</span><span id="line-381"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-382"></span><span>    </span><span id="local-6989586621679071851"><span class="annot"><span class="annottext">go :: Int -&gt; Int -&gt; [Word8] -&gt; [Word8]
</span><a href="#local-6989586621679071851"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071850"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071850"><span class="hs-identifier hs-var">sentinal</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071849"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071849"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071848"><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071848"><span class="hs-identifier hs-var">acc</span></a></span></span><span>
</span><span id="line-383"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071849"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071850"><span class="hs-identifier hs-var">sentinal</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071848"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-384"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071847"><span class="annot"><span class="annottext">w :: Word8
</span><a href="#local-6989586621679071847"><span class="hs-identifier hs-var hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BA -&gt; Int -&gt; Word8
</span><a href="Data.ByteString.Short.Internal.html#indexWord8Array"><span class="hs-identifier hs-var">indexWord8Array</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071855"><span class="hs-identifier hs-var">sbs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071849"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-385"></span><span>                         </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Word8] -&gt; [Word8]
</span><a href="#local-6989586621679071851"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071850"><span class="hs-identifier hs-var">sentinal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071849"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679071847"><span class="hs-identifier hs-var">w</span></a></span><span class="annot"><span class="annottext">Word8 -&gt; [Word8] -&gt; [Word8]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[Word8]
</span><a href="#local-6989586621679071848"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-386"></span><span>
</span><span id="line-387"></span><span>
</span><span id="line-388"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-389"></span><span class="hs-comment">-- Eq and Ord implementations</span><span>
</span><span id="line-390"></span><span>
</span><span id="line-391"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#equateBytes"><span class="hs-identifier hs-type">equateBytes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-392"></span><span id="equateBytes"><span class="annot"><span class="annottext">equateBytes :: ShortByteString -&gt; ShortByteString -&gt; Bool
</span><a href="Data.ByteString.Short.Internal.html#equateBytes"><span class="hs-identifier hs-var hs-var">equateBytes</span></a></span></span><span> </span><span id="local-6989586621679071846"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071846"><span class="hs-identifier hs-var">sbs1</span></a></span></span><span> </span><span id="local-6989586621679071845"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071845"><span class="hs-identifier hs-var">sbs2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-393"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071844"><span class="annot"><span class="annottext">len1 :: Int
</span><a href="#local-6989586621679071844"><span class="hs-identifier hs-var hs-var">len1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071846"><span class="hs-identifier hs-var">sbs1</span></a></span><span>
</span><span id="line-394"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621679071843"><span class="annot"><span class="annottext">len2 :: Int
</span><a href="#local-6989586621679071843"><span class="hs-identifier hs-var hs-var">len2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071845"><span class="hs-identifier hs-var">sbs2</span></a></span><span>
</span><span id="line-395"></span><span>     </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071844"><span class="hs-identifier hs-var">len1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071843"><span class="hs-identifier hs-var">len2</span></a></span><span>
</span><span id="line-396"></span><span>     </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">IO CInt -&gt; CInt
forall a. IO a -&gt; a
</span><a href="Data.ByteString.Internal.html#accursedUnutterablePerformIO"><span class="hs-identifier hs-var">accursedUnutterablePerformIO</span></a></span><span>
</span><span id="line-397"></span><span>               </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BA -&gt; BA -&gt; Int -&gt; IO CInt
</span><a href="Data.ByteString.Short.Internal.html#memcmp_ByteArray"><span class="hs-identifier hs-var">memcmp_ByteArray</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071846"><span class="hs-identifier hs-var">sbs1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071845"><span class="hs-identifier hs-var">sbs2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071844"><span class="hs-identifier hs-var">len1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-398"></span><span>
</span><span id="line-399"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#compareBytes"><span class="hs-identifier hs-type">compareBytes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Ordering"><span class="hs-identifier hs-type">Ordering</span></a></span><span>
</span><span id="line-400"></span><span id="compareBytes"><span class="annot"><span class="annottext">compareBytes :: ShortByteString -&gt; ShortByteString -&gt; Ordering
</span><a href="Data.ByteString.Short.Internal.html#compareBytes"><span class="hs-identifier hs-var hs-var">compareBytes</span></a></span></span><span> </span><span id="local-6989586621679071841"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071841"><span class="hs-identifier hs-var">sbs1</span></a></span></span><span> </span><span id="local-6989586621679071840"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071840"><span class="hs-identifier hs-var">sbs2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-401"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071839"><span class="annot"><span class="annottext">len1 :: Int
</span><a href="#local-6989586621679071839"><span class="hs-identifier hs-var hs-var">len1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071841"><span class="hs-identifier hs-var">sbs1</span></a></span><span>
</span><span id="line-402"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621679071838"><span class="annot"><span class="annottext">len2 :: Int
</span><a href="#local-6989586621679071838"><span class="hs-identifier hs-var hs-var">len2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071840"><span class="hs-identifier hs-var">sbs2</span></a></span><span>
</span><span id="line-403"></span><span>        </span><span class="hs-glyph">!</span><span id="local-6989586621679071837"><span class="annot"><span class="annottext">len :: Int
</span><a href="#local-6989586621679071837"><span class="hs-identifier hs-var hs-var">len</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><a href="../../ghc-prim/src/GHC.Classes.html#min"><span class="hs-identifier hs-var">min</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071839"><span class="hs-identifier hs-var">len1</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071838"><span class="hs-identifier hs-var">len2</span></a></span><span>
</span><span id="line-404"></span><span>     </span><span class="hs-keyword">in</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">IO CInt -&gt; CInt
forall a. IO a -&gt; a
</span><a href="Data.ByteString.Internal.html#accursedUnutterablePerformIO"><span class="hs-identifier hs-var">accursedUnutterablePerformIO</span></a></span><span>
</span><span id="line-405"></span><span>               </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BA -&gt; BA -&gt; Int -&gt; IO CInt
</span><a href="Data.ByteString.Short.Internal.html#memcmp_ByteArray"><span class="hs-identifier hs-var">memcmp_ByteArray</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071841"><span class="hs-identifier hs-var">sbs1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071840"><span class="hs-identifier hs-var">sbs2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071837"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-406"></span><span>          </span><span id="local-6989586621679071835"><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679071835"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679071835"><span class="hs-identifier hs-var">i</span></a></span><span>    </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#LT"><span class="hs-identifier hs-var">LT</span></a></span><span>
</span><span id="line-407"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CInt
</span><a href="#local-6989586621679071835"><span class="hs-identifier hs-var">i</span></a></span><span>    </span><span class="annot"><span class="annottext">CInt -&gt; CInt -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#GT"><span class="hs-identifier hs-var">GT</span></a></span><span>
</span><span id="line-408"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071838"><span class="hs-identifier hs-var">len2</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071839"><span class="hs-identifier hs-var">len1</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#LT"><span class="hs-identifier hs-var">LT</span></a></span><span>
</span><span id="line-409"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071838"><span class="hs-identifier hs-var">len2</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071839"><span class="hs-identifier hs-var">len1</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#GT"><span class="hs-identifier hs-var">GT</span></a></span><span>
</span><span id="line-410"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#EQ"><span class="hs-identifier hs-var">EQ</span></a></span><span>
</span><span id="line-411"></span><span>
</span><span id="line-412"></span><span>
</span><span id="line-413"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-414"></span><span class="hs-comment">-- Appending and concatenation</span><span>
</span><span id="line-415"></span><span>
</span><span id="line-416"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#append"><span class="hs-identifier hs-type">append</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-417"></span><span id="append"><span class="annot"><span class="annottext">append :: ShortByteString -&gt; ShortByteString -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#append"><span class="hs-identifier hs-var hs-var">append</span></a></span></span><span> </span><span id="local-6989586621679071833"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071833"><span class="hs-identifier hs-var">src1</span></a></span></span><span> </span><span id="local-6989586621679071832"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071832"><span class="hs-identifier hs-var">src2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-418"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071831"><span class="annot"><span class="annottext">len1 :: Int
</span><a href="#local-6989586621679071831"><span class="hs-identifier hs-var hs-var">len1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071833"><span class="hs-identifier hs-var">src1</span></a></span><span>
</span><span id="line-419"></span><span>      </span><span class="hs-glyph">!</span><span id="local-6989586621679071830"><span class="annot"><span class="annottext">len2 :: Int
</span><a href="#local-6989586621679071830"><span class="hs-identifier hs-var hs-var">len2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071832"><span class="hs-identifier hs-var">src2</span></a></span><span>
</span><span id="line-420"></span><span>   </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Int -&gt; (forall s. MBA s -&gt; ST s ()) -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#create"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071831"><span class="hs-identifier hs-var">len1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071830"><span class="hs-identifier hs-var">len2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((forall s. MBA s -&gt; ST s ()) -&gt; ShortByteString)
-&gt; (forall s. MBA s -&gt; ST s ()) -&gt; ShortByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679071828"><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071828"><span class="hs-identifier hs-var">dst</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-421"></span><span>        </span><span class="annot"><span class="annottext">BA -&gt; Int -&gt; MBA s -&gt; Int -&gt; Int -&gt; ST s ()
forall s. BA -&gt; Int -&gt; MBA s -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.ByteString.Short.Internal.html#copyByteArray"><span class="hs-identifier hs-var">copyByteArray</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071833"><span class="hs-identifier hs-var">src1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071828"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071831"><span class="hs-identifier hs-var">len1</span></a></span><span>
</span><span id="line-422"></span><span>        </span><span class="annot"><span class="annottext">BA -&gt; Int -&gt; MBA s -&gt; Int -&gt; Int -&gt; ST s ()
forall s. BA -&gt; Int -&gt; MBA s -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.ByteString.Short.Internal.html#copyByteArray"><span class="hs-identifier hs-var">copyByteArray</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071832"><span class="hs-identifier hs-var">src2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071828"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071831"><span class="hs-identifier hs-var">len1</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071830"><span class="hs-identifier hs-var">len2</span></a></span><span>
</span><span id="line-423"></span><span>
</span><span id="line-424"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#concat"><span class="hs-identifier hs-type">concat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-425"></span><span id="concat"><span class="annot"><span class="annottext">concat :: [ShortByteString] -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#concat"><span class="hs-identifier hs-var hs-var">concat</span></a></span></span><span> </span><span id="local-6989586621679071827"><span class="annot"><span class="annottext">[ShortByteString]
</span><a href="#local-6989586621679071827"><span class="hs-identifier hs-var">sbss</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-426"></span><span>    </span><span class="annot"><span class="annottext">Int -&gt; (forall s. MBA s -&gt; ST s ()) -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#create"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; [ShortByteString] -&gt; Int
</span><a href="#local-6989586621679071826"><span class="hs-identifier hs-var">totalLen</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">[ShortByteString]
</span><a href="#local-6989586621679071827"><span class="hs-identifier hs-var">sbss</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679071825"><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071825"><span class="hs-identifier hs-var">dst</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MBA s -&gt; Int -&gt; [ShortByteString] -&gt; ST s ()
forall s. MBA s -&gt; Int -&gt; [ShortByteString] -&gt; ST s ()
</span><a href="#local-6989586621679071824"><span class="hs-identifier hs-var">copy</span></a></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071825"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">[ShortByteString]
</span><a href="#local-6989586621679071827"><span class="hs-identifier hs-var">sbss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-427"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-428"></span><span>    </span><span id="local-6989586621679071826"><span class="annot"><span class="annottext">totalLen :: Int -&gt; [ShortByteString] -&gt; Int
</span><a href="#local-6989586621679071826"><span class="hs-identifier hs-var hs-var">totalLen</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071822"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071822"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071822"><span class="hs-identifier hs-var">acc</span></a></span><span>
</span><span id="line-429"></span><span>    </span><span class="annot"><a href="#local-6989586621679071826"><span class="hs-identifier hs-var">totalLen</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071821"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071821"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679071820"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071820"><span class="hs-identifier hs-var">sbs</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span> </span><span id="local-6989586621679071819"><span class="annot"><span class="annottext">[ShortByteString]
</span><a href="#local-6989586621679071819"><span class="hs-identifier hs-var">sbss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [ShortByteString] -&gt; Int
</span><a href="#local-6989586621679071826"><span class="hs-identifier hs-var">totalLen</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071821"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071820"><span class="hs-identifier hs-var">sbs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ShortByteString]
</span><a href="#local-6989586621679071819"><span class="hs-identifier hs-var">sbss</span></a></span><span>
</span><span id="line-430"></span><span>
</span><span id="line-431"></span><span>    </span><span id="local-6989586621679072310"><span class="annot"><a href="#local-6989586621679071824"><span class="hs-identifier hs-type">copy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-type">MBA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072310"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072310"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-432"></span><span>    </span><span id="local-6989586621679071824"><span class="annot"><span class="annottext">copy :: forall s. MBA s -&gt; Int -&gt; [ShortByteString] -&gt; ST s ()
</span><a href="#local-6989586621679071824"><span class="hs-identifier hs-var hs-var">copy</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">MBA s
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; ST s ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-433"></span><span>    </span><span class="annot"><a href="#local-6989586621679071824"><span class="hs-identifier hs-var">copy</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071815"><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071815"><span class="hs-identifier hs-var">dst</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071814"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071814"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679071813"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071813"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span> </span><span id="local-6989586621679071812"><span class="annot"><span class="annottext">[ShortByteString]
</span><a href="#local-6989586621679071812"><span class="hs-identifier hs-var">sbss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-434"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071811"><span class="annot"><span class="annottext">len :: Int
</span><a href="#local-6989586621679071811"><span class="hs-identifier hs-var hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071813"><span class="hs-identifier hs-var">src</span></a></span><span>
</span><span id="line-435"></span><span>      </span><span class="annot"><span class="annottext">BA -&gt; Int -&gt; MBA s -&gt; Int -&gt; Int -&gt; ST s ()
forall s. BA -&gt; Int -&gt; MBA s -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.ByteString.Short.Internal.html#copyByteArray"><span class="hs-identifier hs-var">copyByteArray</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071813"><span class="hs-identifier hs-var">src</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071815"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071814"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071811"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-436"></span><span>      </span><span class="annot"><span class="annottext">MBA s -&gt; Int -&gt; [ShortByteString] -&gt; ST s ()
forall s. MBA s -&gt; Int -&gt; [ShortByteString] -&gt; ST s ()
</span><a href="#local-6989586621679071824"><span class="hs-identifier hs-var">copy</span></a></span><span> </span><span class="annot"><span class="annottext">MBA s
</span><a href="#local-6989586621679071815"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071814"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071811"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ShortByteString]
</span><a href="#local-6989586621679071812"><span class="hs-identifier hs-var">sbss</span></a></span><span>
</span><span id="line-437"></span><span>
</span><span id="line-438"></span><span>
</span><span id="line-439"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-440"></span><span class="hs-comment">-- Exported low level operations</span><span>
</span><span id="line-441"></span><span>
</span><span id="line-442"></span><span id="local-6989586621679072308"><span class="annot"><a href="Data.ByteString.Short.Internal.html#copyToPtr"><span class="hs-identifier hs-type">copyToPtr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>  </span><span class="hs-comment">-- ^ source data</span><span>
</span><span id="line-443"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>              </span><span class="hs-comment">-- ^ offset into source</span><span>
</span><span id="line-444"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072308"><span class="hs-identifier hs-type">a</span></a></span><span>            </span><span class="hs-comment">-- ^ destination</span><span>
</span><span id="line-445"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>              </span><span class="hs-comment">-- ^ number of bytes to copy</span><span>
</span><span id="line-446"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-447"></span><span id="copyToPtr"><span class="annot"><span class="annottext">copyToPtr :: forall a. ShortByteString -&gt; Int -&gt; Ptr a -&gt; Int -&gt; IO ()
</span><a href="Data.ByteString.Short.Internal.html#copyToPtr"><span class="hs-identifier hs-var hs-var">copyToPtr</span></a></span></span><span> </span><span id="local-6989586621679071810"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071810"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span id="local-6989586621679071809"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071809"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679071808"><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679071808"><span class="hs-identifier hs-var">dst</span></a></span></span><span> </span><span id="local-6989586621679071807"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071807"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-448"></span><span>    </span><span class="annot"><span class="annottext">ST RealWorld () -&gt; IO ()
forall a. ST RealWorld a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#stToIO"><span class="hs-identifier hs-var">stToIO</span></a></span><span> </span><span class="annot"><span class="annottext">(ST RealWorld () -&gt; IO ()) -&gt; ST RealWorld () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-449"></span><span>      </span><span class="annot"><span class="annottext">BA -&gt; Int -&gt; Ptr a -&gt; Int -&gt; ST RealWorld ()
forall a. BA -&gt; Int -&gt; Ptr a -&gt; Int -&gt; ST RealWorld ()
</span><a href="Data.ByteString.Short.Internal.html#copyByteArrayToAddr"><span class="hs-identifier hs-var">copyByteArrayToAddr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShortByteString -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#asBA"><span class="hs-identifier hs-var">asBA</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071810"><span class="hs-identifier hs-var">src</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071809"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679071808"><span class="hs-identifier hs-var">dst</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071807"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-450"></span><span>
</span><span id="line-451"></span><span id="local-6989586621679072305"><span class="annot"><a href="Data.ByteString.Short.Internal.html#createFromPtr"><span class="hs-identifier hs-type">createFromPtr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072305"><span class="hs-identifier hs-type">a</span></a></span><span>   </span><span class="hs-comment">-- ^ source data</span><span>
</span><span id="line-452"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>     </span><span class="hs-comment">-- ^ number of bytes to copy</span><span>
</span><span id="line-453"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span></span><span>
</span><span id="line-454"></span><span id="createFromPtr"><span class="annot"><span class="annottext">createFromPtr :: forall a. Ptr a -&gt; Int -&gt; IO ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#createFromPtr"><span class="hs-identifier hs-var hs-var">createFromPtr</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679071801"><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679071801"><span class="hs-identifier hs-var">ptr</span></a></span></span><span> </span><span id="local-6989586621679071800"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071800"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-455"></span><span>    </span><span class="annot"><span class="annottext">ST RealWorld ShortByteString -&gt; IO ShortByteString
forall a. ST RealWorld a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#stToIO"><span class="hs-identifier hs-var">stToIO</span></a></span><span> </span><span class="annot"><span class="annottext">(ST RealWorld ShortByteString -&gt; IO ShortByteString)
-&gt; ST RealWorld ShortByteString -&gt; IO ShortByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-456"></span><span>      </span><span id="local-6989586621679071799"><span class="annot"><span class="annottext">MBA RealWorld
</span><a href="#local-6989586621679071799"><span class="hs-identifier hs-var">mba</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST RealWorld (MBA RealWorld)
forall s. Int -&gt; ST s (MBA s)
</span><a href="Data.ByteString.Short.Internal.html#newByteArray"><span class="hs-identifier hs-var">newByteArray</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071800"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-457"></span><span>      </span><span class="annot"><span class="annottext">Ptr a -&gt; MBA RealWorld -&gt; Int -&gt; Int -&gt; ST RealWorld ()
forall a. Ptr a -&gt; MBA RealWorld -&gt; Int -&gt; Int -&gt; ST RealWorld ()
</span><a href="Data.ByteString.Short.Internal.html#copyAddrToByteArray"><span class="hs-identifier hs-var">copyAddrToByteArray</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679071801"><span class="hs-identifier hs-var">ptr</span></a></span><span> </span><span class="annot"><span class="annottext">MBA RealWorld
</span><a href="#local-6989586621679071799"><span class="hs-identifier hs-var">mba</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071800"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-458"></span><span>      </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA%23"><span class="hs-identifier hs-type">BA#</span></a></span><span> </span><span id="local-6989586621679071798"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071798"><span class="hs-identifier hs-var">ba#</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">MBA RealWorld -&gt; ST RealWorld BA
forall s. MBA s -&gt; ST s BA
</span><a href="Data.ByteString.Short.Internal.html#unsafeFreezeByteArray"><span class="hs-identifier hs-var">unsafeFreezeByteArray</span></a></span><span> </span><span class="annot"><span class="annottext">MBA RealWorld
</span><a href="#local-6989586621679071799"><span class="hs-identifier hs-var">mba</span></a></span><span>
</span><span id="line-459"></span><span>      </span><span class="annot"><span class="annottext">ShortByteString -&gt; ST RealWorld ShortByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteArray# -&gt; ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#SBS"><span class="hs-identifier hs-var">SBS</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071798"><span class="hs-identifier hs-var">ba#</span></a></span><span> </span><span class="hs-identifier">LEN</span><span class="hs-special">(</span><span class="hs-identifier">len</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-460"></span><span>
</span><span id="line-461"></span><span>
</span><span id="line-462"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-463"></span><span class="hs-comment">-- Primop wrappers</span><span>
</span><span id="line-464"></span><span>
</span><span id="line-465"></span><span class="hs-keyword">data</span><span> </span><span id="BA"><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA"><span class="hs-identifier hs-var">BA</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span id="BA%23"><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA%23"><span class="hs-identifier hs-var">BA#</span></a></span></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#ByteArray%23"><span class="hs-identifier hs-type">ByteArray#</span></a></span><span>
</span><span id="line-466"></span><span class="hs-keyword">data</span><span> </span><span id="MBA"><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-var">MBA</span></a></span></span><span> </span><span id="local-6989586621679072298"><span class="annot"><a href="#local-6989586621679072298"><span class="hs-identifier hs-type">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="MBA%23"><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA%23"><span class="hs-identifier hs-var">MBA#</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#MutableByteArray%23"><span class="hs-identifier hs-type">MutableByteArray#</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072298"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-467"></span><span>
</span><span id="line-468"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#indexCharArray"><span class="hs-identifier hs-type">indexCharArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA"><span class="hs-identifier hs-type">BA</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-469"></span><span id="indexCharArray"><span class="annot"><span class="annottext">indexCharArray :: BA -&gt; Int -&gt; Char
</span><a href="Data.ByteString.Short.Internal.html#indexCharArray"><span class="hs-identifier hs-var hs-var">indexCharArray</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA%23"><span class="hs-identifier hs-type">BA#</span></a></span><span> </span><span id="local-6989586621679071797"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071797"><span class="hs-identifier hs-var">ba#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071796"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071796"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char# -&gt; Char
</span><a href="../../ghc-prim/src/GHC.Types.html#C%23"><span class="hs-identifier hs-var">C#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteArray# -&gt; Int# -&gt; Char#
</span><a href="../../ghc-prim/src/GHC.Prim.html#indexCharArray%23"><span class="hs-identifier hs-var">indexCharArray#</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071797"><span class="hs-identifier hs-var">ba#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071796"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-470"></span><span>
</span><span id="line-471"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#indexWord8Array"><span class="hs-identifier hs-type">indexWord8Array</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA"><span class="hs-identifier hs-type">BA</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-472"></span><span id="indexWord8Array"><span class="annot"><span class="annottext">indexWord8Array :: BA -&gt; Int -&gt; Word8
</span><a href="Data.ByteString.Short.Internal.html#indexWord8Array"><span class="hs-identifier hs-var hs-var">indexWord8Array</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA%23"><span class="hs-identifier hs-type">BA#</span></a></span><span> </span><span id="local-6989586621679071795"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071795"><span class="hs-identifier hs-var">ba#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071794"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071794"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word# -&gt; Word8
</span><a href="../../base/src/GHC.Word.html#W8%23"><span class="hs-identifier hs-var">W8#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteArray# -&gt; Int# -&gt; Word#
</span><a href="../../ghc-prim/src/GHC.Prim.html#indexWord8Array%23"><span class="hs-identifier hs-var">indexWord8Array#</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071795"><span class="hs-identifier hs-var">ba#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071794"><span class="hs-identifier hs-var">i#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-473"></span><span>
</span><span id="line-474"></span><span id="local-6989586621679072342"><span class="annot"><a href="Data.ByteString.Short.Internal.html#newByteArray"><span class="hs-identifier hs-type">newByteArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072342"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-type">MBA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072342"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-475"></span><span id="newByteArray"><span class="annot"><span class="annottext">newByteArray :: forall s. Int -&gt; ST s (MBA s)
</span><a href="Data.ByteString.Short.Internal.html#newByteArray"><span class="hs-identifier hs-var hs-var">newByteArray</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071793"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071793"><span class="hs-identifier hs-var">len#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-476"></span><span>    </span><span class="annot"><span class="annottext">STRep s (MBA s) -&gt; ST s (MBA s)
forall s a. STRep s a -&gt; ST s a
</span><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-var">ST</span></a></span><span> </span><span class="annot"><span class="annottext">(STRep s (MBA s) -&gt; ST s (MBA s))
-&gt; STRep s (MBA s) -&gt; ST s (MBA s)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679071792"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071792"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; State# s -&gt; (# State# s, MutableByteArray# s #)
forall d. Int# -&gt; State# d -&gt; (# State# d, MutableByteArray# d #)
</span><a href="../../ghc-prim/src/GHC.Prim.html#newByteArray%23"><span class="hs-identifier hs-var">newByteArray#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071793"><span class="hs-identifier hs-var">len#</span></a></span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071792"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-477"></span><span>                 </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679071791"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071791"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679071790"><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071790"><span class="hs-identifier hs-var">mba#</span></a></span></span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071791"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">MutableByteArray# s -&gt; MBA s
forall s. MutableByteArray# s -&gt; MBA s
</span><a href="Data.ByteString.Short.Internal.html#MBA%23"><span class="hs-identifier hs-var">MBA#</span></a></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071790"><span class="hs-identifier hs-var">mba#</span></a></span><span> </span><span class="hs-special">#)</span><span class="hs-cpp">

#if MIN_VERSION_base(4,6,0)
</span><span id="local-6989586621679071789"><span class="annot"><a href="Data.ByteString.Short.Internal.html#newPinnedByteArray"><span class="hs-identifier hs-type">newPinnedByteArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679071789"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-type">MBA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679071789"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-481"></span><span id="newPinnedByteArray"><span class="annot"><span class="annottext">newPinnedByteArray :: forall s. Int -&gt; ST s (MBA s)
</span><a href="Data.ByteString.Short.Internal.html#newPinnedByteArray"><span class="hs-identifier hs-var hs-var">newPinnedByteArray</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071788"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071788"><span class="hs-identifier hs-var">len#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-482"></span><span>    </span><span class="annot"><span class="annottext">STRep s (MBA s) -&gt; ST s (MBA s)
forall s a. STRep s a -&gt; ST s a
</span><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-var">ST</span></a></span><span> </span><span class="annot"><span class="annottext">(STRep s (MBA s) -&gt; ST s (MBA s))
-&gt; STRep s (MBA s) -&gt; ST s (MBA s)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679071787"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071787"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int# -&gt; State# s -&gt; (# State# s, MutableByteArray# s #)
forall d. Int# -&gt; State# d -&gt; (# State# d, MutableByteArray# d #)
</span><a href="../../ghc-prim/src/GHC.Prim.html#newPinnedByteArray%23"><span class="hs-identifier hs-var">newPinnedByteArray#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071788"><span class="hs-identifier hs-var">len#</span></a></span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071787"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-483"></span><span>                 </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679071786"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071786"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679071785"><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071785"><span class="hs-identifier hs-var">mba#</span></a></span></span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071786"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">MutableByteArray# s -&gt; MBA s
forall s. MutableByteArray# s -&gt; MBA s
</span><a href="Data.ByteString.Short.Internal.html#MBA%23"><span class="hs-identifier hs-var">MBA#</span></a></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071785"><span class="hs-identifier hs-var">mba#</span></a></span><span> </span><span class="hs-special">#)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-486"></span><span id="local-6989586621679072341"><span class="annot"><a href="Data.ByteString.Short.Internal.html#unsafeFreezeByteArray"><span class="hs-identifier hs-type">unsafeFreezeByteArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-type">MBA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072341"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072341"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA"><span class="hs-identifier hs-type">BA</span></a></span></span><span>
</span><span id="line-487"></span><span id="unsafeFreezeByteArray"><span class="annot"><span class="annottext">unsafeFreezeByteArray :: forall s. MBA s -&gt; ST s BA
</span><a href="Data.ByteString.Short.Internal.html#unsafeFreezeByteArray"><span class="hs-identifier hs-var hs-var">unsafeFreezeByteArray</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA%23"><span class="hs-identifier hs-type">MBA#</span></a></span><span> </span><span id="local-6989586621679071784"><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071784"><span class="hs-identifier hs-var">mba#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-488"></span><span>    </span><span class="annot"><span class="annottext">STRep s BA -&gt; ST s BA
forall s a. STRep s a -&gt; ST s a
</span><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-var">ST</span></a></span><span> </span><span class="annot"><span class="annottext">(STRep s BA -&gt; ST s BA) -&gt; STRep s BA -&gt; ST s BA
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679071783"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071783"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">MutableByteArray# s -&gt; State# s -&gt; (# State# s, ByteArray# #)
forall d.
MutableByteArray# d -&gt; State# d -&gt; (# State# d, ByteArray# #)
</span><a href="../../ghc-prim/src/GHC.Prim.html#unsafeFreezeByteArray%23"><span class="hs-identifier hs-var">unsafeFreezeByteArray#</span></a></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071784"><span class="hs-identifier hs-var">mba#</span></a></span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071783"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-489"></span><span>                 </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679071782"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071782"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679071781"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071781"><span class="hs-identifier hs-var">ba#</span></a></span></span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071782"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ByteArray# -&gt; BA
</span><a href="Data.ByteString.Short.Internal.html#BA%23"><span class="hs-identifier hs-var">BA#</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071781"><span class="hs-identifier hs-var">ba#</span></a></span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-490"></span><span>
</span><span id="line-491"></span><span id="local-6989586621679072319"><span class="annot"><a href="Data.ByteString.Short.Internal.html#writeCharArray"><span class="hs-identifier hs-type">writeCharArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-type">MBA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072319"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072319"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-492"></span><span id="writeCharArray"><span class="annot"><span class="annottext">writeCharArray :: forall s. MBA s -&gt; Int -&gt; Char -&gt; ST s ()
</span><a href="Data.ByteString.Short.Internal.html#writeCharArray"><span class="hs-identifier hs-var hs-var">writeCharArray</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA%23"><span class="hs-identifier hs-type">MBA#</span></a></span><span> </span><span id="local-6989586621679071780"><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071780"><span class="hs-identifier hs-var">mba#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071779"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071779"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#C%23"><span class="hs-identifier hs-type">C#</span></a></span><span> </span><span id="local-6989586621679071778"><span class="annot"><span class="annottext">Char#
</span><a href="#local-6989586621679071778"><span class="hs-identifier hs-var">c#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-493"></span><span>  </span><span class="annot"><span class="annottext">STRep s () -&gt; ST s ()
forall s a. STRep s a -&gt; ST s a
</span><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-var">ST</span></a></span><span> </span><span class="annot"><span class="annottext">(STRep s () -&gt; ST s ()) -&gt; STRep s () -&gt; ST s ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679071777"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071777"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">MutableByteArray# s -&gt; Int# -&gt; Char# -&gt; State# s -&gt; State# s
forall d.
MutableByteArray# d -&gt; Int# -&gt; Char# -&gt; State# d -&gt; State# d
</span><a href="../../ghc-prim/src/GHC.Prim.html#writeCharArray%23"><span class="hs-identifier hs-var">writeCharArray#</span></a></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071780"><span class="hs-identifier hs-var">mba#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071779"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Char#
</span><a href="#local-6989586621679071778"><span class="hs-identifier hs-var">c#</span></a></span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071777"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-494"></span><span>               </span><span id="local-6989586621679071776"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071776"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071776"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-495"></span><span>
</span><span id="line-496"></span><span id="local-6989586621679072314"><span class="annot"><a href="Data.ByteString.Short.Internal.html#writeWord8Array"><span class="hs-identifier hs-type">writeWord8Array</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-type">MBA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072314"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072314"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-497"></span><span id="writeWord8Array"><span class="annot"><span class="annottext">writeWord8Array :: forall s. MBA s -&gt; Int -&gt; Word8 -&gt; ST s ()
</span><a href="Data.ByteString.Short.Internal.html#writeWord8Array"><span class="hs-identifier hs-var hs-var">writeWord8Array</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA%23"><span class="hs-identifier hs-type">MBA#</span></a></span><span> </span><span id="local-6989586621679071775"><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071775"><span class="hs-identifier hs-var">mba#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071774"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071774"><span class="hs-identifier hs-var">i#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#W8%23"><span class="hs-identifier hs-type">W8#</span></a></span><span> </span><span id="local-6989586621679071773"><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679071773"><span class="hs-identifier hs-var">w#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-498"></span><span>  </span><span class="annot"><span class="annottext">STRep s () -&gt; ST s ()
forall s a. STRep s a -&gt; ST s a
</span><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-var">ST</span></a></span><span> </span><span class="annot"><span class="annottext">(STRep s () -&gt; ST s ()) -&gt; STRep s () -&gt; ST s ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679071772"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071772"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">MutableByteArray# s -&gt; Int# -&gt; Word# -&gt; State# s -&gt; State# s
forall d.
MutableByteArray# d -&gt; Int# -&gt; Word# -&gt; State# d -&gt; State# d
</span><a href="../../ghc-prim/src/GHC.Prim.html#writeWord8Array%23"><span class="hs-identifier hs-var">writeWord8Array#</span></a></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071775"><span class="hs-identifier hs-var">mba#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071774"><span class="hs-identifier hs-var">i#</span></a></span><span> </span><span class="annot"><span class="annottext">Word#
</span><a href="#local-6989586621679071773"><span class="hs-identifier hs-var">w#</span></a></span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071772"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-499"></span><span>               </span><span id="local-6989586621679071771"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071771"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071771"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-500"></span><span>
</span><span id="line-501"></span><span id="local-6989586621679072335"><span class="annot"><a href="Data.ByteString.Short.Internal.html#copyAddrToByteArray"><span class="hs-identifier hs-type">copyAddrToByteArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072335"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-type">MBA</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#RealWorld"><span class="hs-identifier hs-type">RealWorld</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#RealWorld"><span class="hs-identifier hs-type">RealWorld</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-502"></span><span id="copyAddrToByteArray"><span class="annot"><span class="annottext">copyAddrToByteArray :: forall a. Ptr a -&gt; MBA RealWorld -&gt; Int -&gt; Int -&gt; ST RealWorld ()
</span><a href="Data.ByteString.Short.Internal.html#copyAddrToByteArray"><span class="hs-identifier hs-var hs-var">copyAddrToByteArray</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span id="local-6989586621679071770"><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679071770"><span class="hs-identifier hs-var">src#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA%23"><span class="hs-identifier hs-type">MBA#</span></a></span><span> </span><span id="local-6989586621679071769"><span class="annot"><span class="annottext">MutableByteArray# RealWorld
</span><a href="#local-6989586621679071769"><span class="hs-identifier hs-var">dst#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071768"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071768"><span class="hs-identifier hs-var">dst_off#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071767"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071767"><span class="hs-identifier hs-var">len#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-503"></span><span>    </span><span class="annot"><span class="annottext">STRep RealWorld () -&gt; ST RealWorld ()
forall s a. STRep s a -&gt; ST s a
</span><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-var">ST</span></a></span><span> </span><span class="annot"><span class="annottext">(STRep RealWorld () -&gt; ST RealWorld ())
-&gt; STRep RealWorld () -&gt; ST RealWorld ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679071766"><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679071766"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Addr#
-&gt; MutableByteArray# RealWorld
-&gt; Int#
-&gt; Int#
-&gt; State# RealWorld
-&gt; State# RealWorld
</span><a href="Data.ByteString.Short.Internal.html#copyAddrToByteArray%23"><span class="hs-identifier hs-var">copyAddrToByteArray#</span></a></span><span> </span><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679071770"><span class="hs-identifier hs-var">src#</span></a></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# RealWorld
</span><a href="#local-6989586621679071769"><span class="hs-identifier hs-var">dst#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071768"><span class="hs-identifier hs-var">dst_off#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071767"><span class="hs-identifier hs-var">len#</span></a></span><span> </span><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679071766"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-504"></span><span>                 </span><span id="local-6989586621679071764"><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679071764"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679071764"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-505"></span><span>
</span><span id="line-506"></span><span id="local-6989586621679072306"><span class="annot"><a href="Data.ByteString.Short.Internal.html#copyByteArrayToAddr"><span class="hs-identifier hs-type">copyByteArrayToAddr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA"><span class="hs-identifier hs-type">BA</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072306"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#RealWorld"><span class="hs-identifier hs-type">RealWorld</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-507"></span><span id="copyByteArrayToAddr"><span class="annot"><span class="annottext">copyByteArrayToAddr :: forall a. BA -&gt; Int -&gt; Ptr a -&gt; Int -&gt; ST RealWorld ()
</span><a href="Data.ByteString.Short.Internal.html#copyByteArrayToAddr"><span class="hs-identifier hs-var hs-var">copyByteArrayToAddr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA%23"><span class="hs-identifier hs-type">BA#</span></a></span><span> </span><span id="local-6989586621679071763"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071763"><span class="hs-identifier hs-var">src#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071762"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071762"><span class="hs-identifier hs-var">src_off#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span id="local-6989586621679071761"><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679071761"><span class="hs-identifier hs-var">dst#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071760"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071760"><span class="hs-identifier hs-var">len#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-508"></span><span>    </span><span class="annot"><span class="annottext">STRep RealWorld () -&gt; ST RealWorld ()
forall s a. STRep s a -&gt; ST s a
</span><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-var">ST</span></a></span><span> </span><span class="annot"><span class="annottext">(STRep RealWorld () -&gt; ST RealWorld ())
-&gt; STRep RealWorld () -&gt; ST RealWorld ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679071759"><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679071759"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteArray#
-&gt; Int# -&gt; Addr# -&gt; Int# -&gt; State# RealWorld -&gt; State# RealWorld
</span><a href="Data.ByteString.Short.Internal.html#copyByteArrayToAddr%23"><span class="hs-identifier hs-var">copyByteArrayToAddr#</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071763"><span class="hs-identifier hs-var">src#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071762"><span class="hs-identifier hs-var">src_off#</span></a></span><span> </span><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679071761"><span class="hs-identifier hs-var">dst#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071760"><span class="hs-identifier hs-var">len#</span></a></span><span> </span><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679071759"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-509"></span><span>                 </span><span id="local-6989586621679071757"><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679071757"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">State# RealWorld
</span><a href="#local-6989586621679071757"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-510"></span><span>
</span><span id="line-511"></span><span id="local-6989586621679072331"><span class="annot"><a href="Data.ByteString.Short.Internal.html#copyByteArray"><span class="hs-identifier hs-type">copyByteArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA"><span class="hs-identifier hs-type">BA</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA"><span class="hs-identifier hs-type">MBA</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072331"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072331"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-512"></span><span id="copyByteArray"><span class="annot"><span class="annottext">copyByteArray :: forall s. BA -&gt; Int -&gt; MBA s -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.ByteString.Short.Internal.html#copyByteArray"><span class="hs-identifier hs-var hs-var">copyByteArray</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA%23"><span class="hs-identifier hs-type">BA#</span></a></span><span> </span><span id="local-6989586621679071756"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071756"><span class="hs-identifier hs-var">src#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071755"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071755"><span class="hs-identifier hs-var">src_off#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#MBA%23"><span class="hs-identifier hs-type">MBA#</span></a></span><span> </span><span id="local-6989586621679071754"><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071754"><span class="hs-identifier hs-var">dst#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071753"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071753"><span class="hs-identifier hs-var">dst_off#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#I%23"><span class="hs-identifier hs-type">I#</span></a></span><span> </span><span id="local-6989586621679071752"><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071752"><span class="hs-identifier hs-var">len#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-513"></span><span>    </span><span class="annot"><span class="annottext">STRep s () -&gt; ST s ()
forall s a. STRep s a -&gt; ST s a
</span><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-var">ST</span></a></span><span> </span><span class="annot"><span class="annottext">(STRep s () -&gt; ST s ()) -&gt; STRep s () -&gt; ST s ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679071751"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071751"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteArray#
-&gt; Int#
-&gt; MutableByteArray# s
-&gt; Int#
-&gt; Int#
-&gt; State# s
-&gt; State# s
forall s.
ByteArray#
-&gt; Int#
-&gt; MutableByteArray# s
-&gt; Int#
-&gt; Int#
-&gt; State# s
-&gt; State# s
</span><a href="Data.ByteString.Short.Internal.html#copyByteArray%23"><span class="hs-identifier hs-var">copyByteArray#</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071756"><span class="hs-identifier hs-var">src#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071755"><span class="hs-identifier hs-var">src_off#</span></a></span><span> </span><span class="annot"><span class="annottext">MutableByteArray# s
</span><a href="#local-6989586621679071754"><span class="hs-identifier hs-var">dst#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071753"><span class="hs-identifier hs-var">dst_off#</span></a></span><span> </span><span class="annot"><span class="annottext">Int#
</span><a href="#local-6989586621679071752"><span class="hs-identifier hs-var">len#</span></a></span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071751"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-514"></span><span>                 </span><span id="local-6989586621679071749"><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071749"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(#</span><span> </span><span class="annot"><span class="annottext">State# s
</span><a href="#local-6989586621679071749"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">#)</span><span>
</span><span id="line-515"></span><span>
</span><span id="line-516"></span><span>
</span><span id="line-517"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-518"></span><span class="hs-comment">-- FFI imports</span><span>
</span><span id="line-519"></span><span>
</span><span id="line-520"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#memcmp_ByteArray"><span class="hs-identifier hs-type">memcmp_ByteArray</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA"><span class="hs-identifier hs-type">BA</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA"><span class="hs-identifier hs-type">BA</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-521"></span><span id="memcmp_ByteArray"><span class="annot"><span class="annottext">memcmp_ByteArray :: BA -&gt; BA -&gt; Int -&gt; IO CInt
</span><a href="Data.ByteString.Short.Internal.html#memcmp_ByteArray"><span class="hs-identifier hs-var hs-var">memcmp_ByteArray</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA%23"><span class="hs-identifier hs-type">BA#</span></a></span><span> </span><span id="local-6989586621679071748"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071748"><span class="hs-identifier hs-var">ba1#</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.Short.Internal.html#BA%23"><span class="hs-identifier hs-type">BA#</span></a></span><span> </span><span id="local-6989586621679071747"><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071747"><span class="hs-identifier hs-var">ba2#</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679071746"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071746"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-522"></span><span>  </span><span class="annot"><span class="annottext">ByteArray# -&gt; ByteArray# -&gt; CSize -&gt; IO CInt
</span><a href="Data.ByteString.Short.Internal.html#c_memcmp_ByteArray"><span class="hs-identifier hs-var">c_memcmp_ByteArray</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071748"><span class="hs-identifier hs-var">ba1#</span></a></span><span> </span><span class="annot"><span class="annottext">ByteArray#
</span><a href="#local-6989586621679071747"><span class="hs-identifier hs-var">ba2#</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; CSize
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071746"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-523"></span><span>
</span><span id="line-524"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;string.h memcmp&quot;</span></span><span>
</span><span id="line-525"></span><span>  </span><span id="c_memcmp_ByteArray"><span class="annot"><a href="Data.ByteString.Short.Internal.html#c_memcmp_ByteArray"><span class="hs-identifier hs-var">c_memcmp_ByteArray</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#ByteArray%23"><span class="hs-identifier hs-type">ByteArray#</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#ByteArray%23"><span class="hs-identifier hs-type">ByteArray#</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#CSize"><span class="hs-identifier hs-type">CSize</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span>
</span><span id="line-526"></span><span>
</span><span id="line-527"></span><span>
</span><span id="line-528"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-529"></span><span class="hs-comment">-- Primop replacements</span><span>
</span><span id="line-530"></span><span>
</span><span id="line-531"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#copyAddrToByteArray%23"><span class="hs-identifier hs-type">copyAddrToByteArray#</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Addr%23"><span class="hs-identifier hs-type">Addr#</span></a></span><span>
</span><span id="line-532"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#MutableByteArray%23"><span class="hs-identifier hs-type">MutableByteArray#</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#RealWorld"><span class="hs-identifier hs-type">RealWorld</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span>
</span><span id="line-533"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span>
</span><span id="line-534"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#State%23"><span class="hs-identifier hs-type">State#</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#RealWorld"><span class="hs-identifier hs-type">RealWorld</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#State%23"><span class="hs-identifier hs-type">State#</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#RealWorld"><span class="hs-identifier hs-type">RealWorld</span></a></span><span>
</span><span id="line-535"></span><span>
</span><span id="line-536"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#copyByteArrayToAddr%23"><span class="hs-identifier hs-type">copyByteArrayToAddr#</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#ByteArray%23"><span class="hs-identifier hs-type">ByteArray#</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span>
</span><span id="line-537"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Addr%23"><span class="hs-identifier hs-type">Addr#</span></a></span><span>
</span><span id="line-538"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span>
</span><span id="line-539"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#State%23"><span class="hs-identifier hs-type">State#</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#RealWorld"><span class="hs-identifier hs-type">RealWorld</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#State%23"><span class="hs-identifier hs-type">State#</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#RealWorld"><span class="hs-identifier hs-type">RealWorld</span></a></span><span>
</span><span id="line-540"></span><span>
</span><span id="line-541"></span><span id="local-6989586621679072290"><span class="annot"><a href="Data.ByteString.Short.Internal.html#copyByteArray%23"><span class="hs-identifier hs-type">copyByteArray#</span></a></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#ByteArray%23"><span class="hs-identifier hs-type">ByteArray#</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span>
</span><span id="line-542"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#MutableByteArray%23"><span class="hs-identifier hs-type">MutableByteArray#</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072290"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span>
</span><span id="line-543"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#Int%23"><span class="hs-identifier hs-type">Int#</span></a></span><span>
</span><span id="line-544"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#State%23"><span class="hs-identifier hs-type">State#</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072290"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Prim.html#State%23"><span class="hs-identifier hs-type">State#</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072290"><span class="hs-identifier hs-type">s</span></a></span></span><span class="hs-cpp">

#if MIN_VERSION_base(4,7,0)
</span><span>
</span><span id="line-548"></span><span class="hs-comment">-- These exist as real primops in ghc-7.8, and for before that we use</span><span>
</span><span id="line-549"></span><span class="hs-comment">-- FFI to C memcpy.</span><span>
</span><span id="line-550"></span><span id="copyAddrToByteArray%23"><span class="annot"><span class="annottext">copyAddrToByteArray# :: Addr#
-&gt; MutableByteArray# RealWorld
-&gt; Int#
-&gt; Int#
-&gt; State# RealWorld
-&gt; State# RealWorld
</span><a href="Data.ByteString.Short.Internal.html#copyAddrToByteArray%23"><span class="hs-identifier hs-var hs-var">copyAddrToByteArray#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Addr#
-&gt; MutableByteArray# RealWorld
-&gt; Int#
-&gt; Int#
-&gt; State# RealWorld
-&gt; State# RealWorld
forall d.
Addr#
-&gt; MutableByteArray# d -&gt; Int# -&gt; Int# -&gt; State# d -&gt; State# d
</span><a href="../../ghc-prim/src/GHC.Prim.html#copyAddrToByteArray%23"><span class="hs-identifier hs-var">GHC.Exts.copyAddrToByteArray#</span></a></span><span>
</span><span id="line-551"></span><span id="copyByteArrayToAddr%23"><span class="annot"><span class="annottext">copyByteArrayToAddr# :: ByteArray#
-&gt; Int# -&gt; Addr# -&gt; Int# -&gt; State# RealWorld -&gt; State# RealWorld
</span><a href="Data.ByteString.Short.Internal.html#copyByteArrayToAddr%23"><span class="hs-identifier hs-var hs-var">copyByteArrayToAddr#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteArray#
-&gt; Int# -&gt; Addr# -&gt; Int# -&gt; State# RealWorld -&gt; State# RealWorld
forall d.
ByteArray# -&gt; Int# -&gt; Addr# -&gt; Int# -&gt; State# d -&gt; State# d
</span><a href="../../ghc-prim/src/GHC.Prim.html#copyByteArrayToAddr%23"><span class="hs-identifier hs-var">GHC.Exts.copyByteArrayToAddr#</span></a></span><span class="hs-cpp">

#else
</span><span>
</span><span id="line-555"></span><span class="hs-identifier">copyAddrToByteArray#</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-identifier">dst</span><span> </span><span class="hs-identifier">dst_off</span><span> </span><span class="hs-identifier">len</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-556"></span><span>  </span><span class="hs-identifier">unIO_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">memcpy_AddrToByteArray</span><span> </span><span class="hs-identifier">dst</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">clong</span><span> </span><span class="hs-identifier">dst_off</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">csize</span><span> </span><span class="hs-identifier">len</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">s</span><span>
</span><span id="line-557"></span><span>
</span><span id="line-558"></span><span class="hs-identifier">copyAddrToByteArray0</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MutableByteArray#</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int#</span><span>
</span><span id="line-559"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">State#</span><span> </span><span class="hs-identifier">RealWorld</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">State#</span><span> </span><span class="hs-identifier">RealWorld</span><span>
</span><span id="line-560"></span><span class="hs-identifier">copyAddrToByteArray0</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-identifier">dst</span><span> </span><span class="hs-identifier">len</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-561"></span><span>  </span><span class="hs-identifier">unIO_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">memcpy_AddrToByteArray0</span><span> </span><span class="hs-identifier">dst</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">csize</span><span> </span><span class="hs-identifier">len</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">s</span><span>
</span><span id="line-562"></span><span>
</span><span id="line-563"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">copyAddrToByteArray#</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-564"></span><span class="hs-pragma">{-# RULES</span><span> </span><span class="hs-pragma">&quot;copyAddrToByteArray# dst_off=0&quot;</span><span>
</span><span id="line-565"></span><span>      </span><span class="hs-pragma">forall</span><span> </span><span class="hs-pragma">src</span><span> </span><span class="hs-pragma">dst</span><span> </span><span class="hs-pragma">len</span><span> </span><span class="hs-pragma">s</span><span class="hs-pragma">.</span><span>
</span><span id="line-566"></span><span>          </span><span class="hs-pragma">copyAddrToByteArray#</span><span> </span><span class="hs-pragma">src</span><span> </span><span class="hs-pragma">dst</span><span> </span><span class="hs-pragma">0#</span><span> </span><span class="hs-pragma">len</span><span> </span><span class="hs-pragma">s</span><span>
</span><span id="line-567"></span><span>        </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">copyAddrToByteArray0</span><span> </span><span class="hs-pragma">src</span><span> </span><span class="hs-pragma">dst</span><span>    </span><span class="hs-pragma">len</span><span> </span><span class="hs-pragma">s</span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-568"></span><span>
</span><span id="line-569"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;fpstring.h fps_memcpy_offsets&quot;</span><span>
</span><span id="line-570"></span><span>  </span><span class="hs-identifier">memcpy_AddrToByteArray</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MutableByteArray#</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CLong</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CLong</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CSize</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-571"></span><span>
</span><span id="line-572"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;string.h memcpy&quot;</span><span>
</span><span id="line-573"></span><span>  </span><span class="hs-identifier">memcpy_AddrToByteArray0</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MutableByteArray#</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CSize</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-574"></span><span>
</span><span id="line-575"></span><span>
</span><span id="line-576"></span><span class="hs-identifier">copyByteArrayToAddr#</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-identifier">src_off</span><span> </span><span class="hs-identifier">dst</span><span> </span><span class="hs-identifier">len</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-577"></span><span>  </span><span class="hs-identifier">unIO_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">memcpy_ByteArrayToAddr</span><span> </span><span class="hs-identifier">dst</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">clong</span><span> </span><span class="hs-identifier">src_off</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">csize</span><span> </span><span class="hs-identifier">len</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">s</span><span>
</span><span id="line-578"></span><span>
</span><span id="line-579"></span><span class="hs-identifier">copyByteArrayToAddr0</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ByteArray#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Addr#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Int#</span><span>
</span><span id="line-580"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">State#</span><span> </span><span class="hs-identifier">RealWorld</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">State#</span><span> </span><span class="hs-identifier">RealWorld</span><span>
</span><span id="line-581"></span><span class="hs-identifier">copyByteArrayToAddr0</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-identifier">dst</span><span> </span><span class="hs-identifier">len</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-582"></span><span>  </span><span class="hs-identifier">unIO_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">memcpy_ByteArrayToAddr0</span><span> </span><span class="hs-identifier">dst</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">csize</span><span> </span><span class="hs-identifier">len</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">s</span><span>
</span><span id="line-583"></span><span>
</span><span id="line-584"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">copyByteArrayToAddr#</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-585"></span><span class="hs-pragma">{-# RULES</span><span> </span><span class="hs-pragma">&quot;copyByteArrayToAddr# src_off=0&quot;</span><span>
</span><span id="line-586"></span><span>      </span><span class="hs-pragma">forall</span><span> </span><span class="hs-pragma">src</span><span> </span><span class="hs-pragma">dst</span><span> </span><span class="hs-pragma">len</span><span> </span><span class="hs-pragma">s</span><span class="hs-pragma">.</span><span>
</span><span id="line-587"></span><span>          </span><span class="hs-pragma">copyByteArrayToAddr#</span><span> </span><span class="hs-pragma">src</span><span> </span><span class="hs-pragma">0#</span><span> </span><span class="hs-pragma">dst</span><span> </span><span class="hs-pragma">len</span><span> </span><span class="hs-pragma">s</span><span>
</span><span id="line-588"></span><span>        </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">copyByteArrayToAddr0</span><span> </span><span class="hs-pragma">src</span><span>    </span><span class="hs-pragma">dst</span><span> </span><span class="hs-pragma">len</span><span> </span><span class="hs-pragma">s</span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-589"></span><span>
</span><span id="line-590"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;fpstring.h fps_memcpy_offsets&quot;</span><span>
</span><span id="line-591"></span><span>  </span><span class="hs-identifier">memcpy_ByteArrayToAddr</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CLong</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ByteArray#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CLong</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CSize</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-592"></span><span>
</span><span id="line-593"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;string.h memcpy&quot;</span><span>
</span><span id="line-594"></span><span>  </span><span class="hs-identifier">memcpy_ByteArrayToAddr0</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Addr#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ByteArray#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CSize</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-595"></span><span>
</span><span id="line-596"></span><span>
</span><span id="line-597"></span><span class="hs-identifier">unIO_</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">State#</span><span> </span><span class="hs-identifier">RealWorld</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">State#</span><span> </span><span class="hs-identifier">RealWorld</span><span>
</span><span id="line-598"></span><span class="hs-identifier">unIO_</span><span> </span><span class="hs-identifier">io</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">unIO</span><span> </span><span class="hs-identifier">io</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">(#</span><span> </span><span class="hs-identifier">s</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">s</span><span>
</span><span id="line-599"></span><span>
</span><span id="line-600"></span><span class="hs-identifier">clong</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Int#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CLong</span><span>
</span><span id="line-601"></span><span class="hs-identifier">clong</span><span> </span><span class="hs-identifier">i#</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">I#</span><span> </span><span class="hs-identifier">i#</span><span class="hs-special">)</span><span>
</span><span id="line-602"></span><span>
</span><span id="line-603"></span><span class="hs-identifier">csize</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Int#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CSize</span><span>
</span><span id="line-604"></span><span class="hs-identifier">csize</span><span> </span><span class="hs-identifier">i#</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">I#</span><span> </span><span class="hs-identifier">i#</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">
#if MIN_VERSION_base(4,5,0)
</span><span id="copyByteArray%23"><span class="annot"><span class="annottext">copyByteArray# :: forall s.
ByteArray#
-&gt; Int#
-&gt; MutableByteArray# s
-&gt; Int#
-&gt; Int#
-&gt; State# s
-&gt; State# s
</span><a href="Data.ByteString.Short.Internal.html#copyByteArray%23"><span class="hs-identifier hs-var hs-var">copyByteArray#</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteArray#
-&gt; Int#
-&gt; MutableByteArray# s
-&gt; Int#
-&gt; Int#
-&gt; State# s
-&gt; State# s
forall s.
ByteArray#
-&gt; Int#
-&gt; MutableByteArray# s
-&gt; Int#
-&gt; Int#
-&gt; State# s
-&gt; State# s
</span><a href="../../ghc-prim/src/GHC.Prim.html#copyByteArray%23"><span class="hs-identifier hs-var">GHC.Exts.copyByteArray#</span></a></span><span class="hs-cpp">
#else
</span><span class="hs-identifier">copyByteArray#</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-identifier">src_off</span><span> </span><span class="hs-identifier">dst</span><span> </span><span class="hs-identifier">dst_off</span><span> </span><span class="hs-identifier">len</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-611"></span><span>    </span><span class="hs-identifier">unST_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unsafeIOToST</span><span>
</span><span id="line-612"></span><span>      </span><span class="hs-special">(</span><span class="hs-identifier">memcpy_ByteArray</span><span> </span><span class="hs-identifier">dst</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">clong</span><span> </span><span class="hs-identifier">dst_off</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">clong</span><span> </span><span class="hs-identifier">src_off</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">csize</span><span> </span><span class="hs-identifier">len</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">s</span><span>
</span><span id="line-613"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-614"></span><span>    </span><span class="hs-identifier">unST</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ST</span><span> </span><span class="hs-identifier">st</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">st</span><span>
</span><span id="line-615"></span><span>    </span><span class="hs-identifier">unST_</span><span> </span><span class="hs-identifier">st</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-identifier">unST</span><span> </span><span class="hs-identifier">st</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">(#</span><span> </span><span class="hs-identifier">s</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">s</span><span>
</span><span id="line-616"></span><span>
</span><span id="line-617"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">ccall</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;fpstring.h fps_memcpy_offsets&quot;</span><span>
</span><span id="line-618"></span><span>  </span><span class="hs-identifier">memcpy_ByteArray</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MutableByteArray#</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CLong</span><span>
</span><span id="line-619"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ByteArray#</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CLong</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CSize</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-622"></span><span class="hs-comment">-- | /O(n)./ Construct a new @ShortByteString@ from a @CString@. The</span><span>
</span><span id="line-623"></span><span class="hs-comment">-- resulting @ShortByteString@ is an immutable copy of the original</span><span>
</span><span id="line-624"></span><span class="hs-comment">-- @CString@, and is managed on the Haskell heap. The original</span><span>
</span><span id="line-625"></span><span class="hs-comment">-- @CString@ must be null terminated.</span><span>
</span><span id="line-626"></span><span class="hs-comment">--</span><span>
</span><span id="line-627"></span><span class="hs-comment">-- @since 0.10.10.0</span><span>
</span><span id="line-628"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#packCString"><span class="hs-identifier hs-type">packCString</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.String.html#CString"><span class="hs-identifier hs-type">CString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-629"></span><span id="packCString"><span class="annot"><span class="annottext">packCString :: CString -&gt; IO ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packCString"><span class="hs-identifier hs-var hs-var">packCString</span></a></span></span><span> </span><span id="local-6989586621679071744"><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071744"><span class="hs-identifier hs-var">cstr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-630"></span><span>  </span><span id="local-6989586621679071743"><span class="annot"><span class="annottext">CSize
</span><a href="#local-6989586621679071743"><span class="hs-identifier hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CString -&gt; IO CSize
</span><a href="Data.ByteString.Internal.html#c_strlen"><span class="hs-identifier hs-var">c_strlen</span></a></span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071744"><span class="hs-identifier hs-var">cstr</span></a></span><span>
</span><span id="line-631"></span><span>  </span><span class="annot"><span class="annottext">CStringLen -&gt; IO ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packCStringLen"><span class="hs-identifier hs-var">packCStringLen</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071744"><span class="hs-identifier hs-var">cstr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CSize -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">CSize
</span><a href="#local-6989586621679071743"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-632"></span><span>
</span><span id="line-633"></span><span class="hs-comment">-- | /O(n)./ Construct a new @ShortByteString@ from a @CStringLen@. The</span><span>
</span><span id="line-634"></span><span class="hs-comment">-- resulting @ShortByteString@ is an immutable copy of the original @CStringLen@.</span><span>
</span><span id="line-635"></span><span class="hs-comment">-- The @ShortByteString@ is a normal Haskell value and will be managed on the</span><span>
</span><span id="line-636"></span><span class="hs-comment">-- Haskell heap.</span><span>
</span><span id="line-637"></span><span class="hs-comment">--</span><span>
</span><span id="line-638"></span><span class="hs-comment">-- @since 0.10.10.0</span><span>
</span><span id="line-639"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#packCStringLen"><span class="hs-identifier hs-type">packCStringLen</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.String.html#CStringLen"><span class="hs-identifier hs-type">CStringLen</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span>
</span><span id="line-640"></span><span id="packCStringLen"><span class="annot"><span class="annottext">packCStringLen :: CStringLen -&gt; IO ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#packCStringLen"><span class="hs-identifier hs-var hs-var">packCStringLen</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679071742"><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071742"><span class="hs-identifier hs-var">cstr</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679071741"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071741"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071741"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CString -&gt; Int -&gt; IO ShortByteString
forall a. Ptr a -&gt; Int -&gt; IO ShortByteString
</span><a href="Data.ByteString.Short.Internal.html#createFromPtr"><span class="hs-identifier hs-var">createFromPtr</span></a></span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071742"><span class="hs-identifier hs-var">cstr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071741"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-641"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#packCStringLen"><span class="hs-identifier hs-var">packCStringLen</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CString
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679071740"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071740"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-642"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; String -&gt; IO ShortByteString
forall a. String -&gt; String -&gt; IO a
</span><a href="Data.ByteString.Short.Internal.html#moduleErrorIO"><span class="hs-identifier hs-var">moduleErrorIO</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;packCStringLen&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;negative length: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071740"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-643"></span><span>
</span><span id="line-644"></span><span class="hs-comment">-- | /O(n) construction./ Use a @ShortByteString@ with a function requiring a</span><span>
</span><span id="line-645"></span><span class="hs-comment">-- null-terminated @CString@.  The @CString@ is a copy and will be freed</span><span>
</span><span id="line-646"></span><span class="hs-comment">-- automatically; it must not be stored or used after the</span><span>
</span><span id="line-647"></span><span class="hs-comment">-- subcomputation finishes.</span><span>
</span><span id="line-648"></span><span class="hs-comment">--</span><span>
</span><span id="line-649"></span><span class="hs-comment">-- @since 0.10.10.0</span><span>
</span><span id="line-650"></span><span id="local-6989586621679072283"><span class="annot"><a href="Data.ByteString.Short.Internal.html#useAsCString"><span class="hs-identifier hs-type">useAsCString</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Foreign.C.String.html#CString"><span class="hs-identifier hs-type">CString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072283"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072283"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-651"></span><span id="useAsCString"><span class="annot"><span class="annottext">useAsCString :: forall a. ShortByteString -&gt; (CString -&gt; IO a) -&gt; IO a
</span><a href="Data.ByteString.Short.Internal.html#useAsCString"><span class="hs-identifier hs-var hs-var">useAsCString</span></a></span></span><span> </span><span id="local-6989586621679071728"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071728"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span id="local-6989586621679071727"><span class="annot"><span class="annottext">CString -&gt; IO a
</span><a href="#local-6989586621679071727"><span class="hs-identifier hs-var">action</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-652"></span><span>  </span><span class="annot"><span class="annottext">Int -&gt; (CString -&gt; IO a) -&gt; IO a
forall a b. Int -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="../../base/src/Foreign.Marshal.Alloc.html#allocaBytes"><span class="hs-identifier hs-var">allocaBytes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071726"><span class="hs-identifier hs-var">l</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((CString -&gt; IO a) -&gt; IO a) -&gt; (CString -&gt; IO a) -&gt; IO a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679071725"><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071725"><span class="hs-identifier hs-var">buf</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-653"></span><span>      </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int -&gt; CString -&gt; Int -&gt; IO ()
forall a. ShortByteString -&gt; Int -&gt; Ptr a -&gt; Int -&gt; IO ()
</span><a href="Data.ByteString.Short.Internal.html#copyToPtr"><span class="hs-identifier hs-var">copyToPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071728"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071725"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071726"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-654"></span><span>      </span><span class="annot"><span class="annottext">CString -&gt; Int -&gt; Word8 -&gt; IO ()
forall a b. Storable a =&gt; Ptr b -&gt; Int -&gt; a -&gt; IO ()
</span><a href="../../base/src/Foreign.Storable.html#pokeByteOff"><span class="hs-identifier hs-var">pokeByteOff</span></a></span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071725"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071726"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span class="hs-glyph">::</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-655"></span><span>      </span><span class="annot"><span class="annottext">CString -&gt; IO a
</span><a href="#local-6989586621679071727"><span class="hs-identifier hs-var">action</span></a></span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071725"><span class="hs-identifier hs-var">buf</span></a></span><span>
</span><span id="line-656"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679071726"><span class="annot"><span class="annottext">l :: Int
</span><a href="#local-6989586621679071726"><span class="hs-identifier hs-var hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071728"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-657"></span><span>
</span><span id="line-658"></span><span class="hs-comment">-- | /O(n) construction./ Use a @ShortByteString@ with a function requiring a @CStringLen@.</span><span>
</span><span id="line-659"></span><span class="hs-comment">-- As for @useAsCString@ this function makes a copy of the original @ShortByteString@.</span><span>
</span><span id="line-660"></span><span class="hs-comment">-- It must not be stored or used after the subcomputation finishes.</span><span>
</span><span id="line-661"></span><span class="hs-comment">--</span><span>
</span><span id="line-662"></span><span class="hs-comment">-- @since 0.10.10.0</span><span>
</span><span id="line-663"></span><span id="local-6989586621679072276"><span class="annot"><a href="Data.ByteString.Short.Internal.html#useAsCStringLen"><span class="hs-identifier hs-type">useAsCStringLen</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#ShortByteString"><span class="hs-identifier hs-type">ShortByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Foreign.C.String.html#CStringLen"><span class="hs-identifier hs-type">CStringLen</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072276"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072276"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-664"></span><span id="useAsCStringLen"><span class="annot"><span class="annottext">useAsCStringLen :: forall a. ShortByteString -&gt; (CStringLen -&gt; IO a) -&gt; IO a
</span><a href="Data.ByteString.Short.Internal.html#useAsCStringLen"><span class="hs-identifier hs-var hs-var">useAsCStringLen</span></a></span></span><span> </span><span id="local-6989586621679071721"><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071721"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span id="local-6989586621679071720"><span class="annot"><span class="annottext">CStringLen -&gt; IO a
</span><a href="#local-6989586621679071720"><span class="hs-identifier hs-var">action</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-665"></span><span>  </span><span class="annot"><span class="annottext">Int -&gt; (CString -&gt; IO a) -&gt; IO a
forall a b. Int -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="../../base/src/Foreign.Marshal.Alloc.html#allocaBytes"><span class="hs-identifier hs-var">allocaBytes</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071719"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">((CString -&gt; IO a) -&gt; IO a) -&gt; (CString -&gt; IO a) -&gt; IO a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679071718"><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071718"><span class="hs-identifier hs-var">buf</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-666"></span><span>      </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int -&gt; CString -&gt; Int -&gt; IO ()
forall a. ShortByteString -&gt; Int -&gt; Ptr a -&gt; Int -&gt; IO ()
</span><a href="Data.ByteString.Short.Internal.html#copyToPtr"><span class="hs-identifier hs-var">copyToPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071721"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071718"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071719"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-667"></span><span>      </span><span class="annot"><span class="annottext">CStringLen -&gt; IO a
</span><a href="#local-6989586621679071720"><span class="hs-identifier hs-var">action</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679071718"><span class="hs-identifier hs-var">buf</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679071719"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-668"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679071719"><span class="annot"><span class="annottext">l :: Int
</span><a href="#local-6989586621679071719"><span class="hs-identifier hs-var hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShortByteString -&gt; Int
</span><a href="Data.ByteString.Short.Internal.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">ShortByteString
</span><a href="#local-6989586621679071721"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-669"></span><span>
</span><span id="line-670"></span><span class="hs-comment">-- ---------------------------------------------------------------------</span><span>
</span><span id="line-671"></span><span class="hs-comment">-- Internal utilities</span><span>
</span><span id="line-672"></span><span>
</span><span id="line-673"></span><span id="local-6989586621679072284"><span class="annot"><a href="Data.ByteString.Short.Internal.html#moduleErrorIO"><span class="hs-identifier hs-type">moduleErrorIO</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679072284"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-674"></span><span id="moduleErrorIO"><span class="annot"><span class="annottext">moduleErrorIO :: forall a. String -&gt; String -&gt; IO a
</span><a href="Data.ByteString.Short.Internal.html#moduleErrorIO"><span class="hs-identifier hs-var hs-var">moduleErrorIO</span></a></span></span><span> </span><span id="local-6989586621679071715"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071715"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621679071714"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071714"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOError -&gt; IO a
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IOError -&gt; IO a) -&gt; (String -&gt; IOError) -&gt; String -&gt; IO a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; IOError
</span><a href="../../base/src/GHC.IO.Exception.html#userError"><span class="hs-identifier hs-var">userError</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; IO a) -&gt; String -&gt; IO a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
</span><a href="Data.ByteString.Short.Internal.html#moduleErrorMsg"><span class="hs-identifier hs-var">moduleErrorMsg</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071715"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071714"><span class="hs-identifier hs-var">msg</span></a></span><span>
</span><span id="line-675"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Short.Internal.html#moduleErrorIO"><span class="hs-pragma hs-type">moduleErrorIO</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-676"></span><span>
</span><span id="line-677"></span><span class="annot"><a href="Data.ByteString.Short.Internal.html#moduleErrorMsg"><span class="hs-identifier hs-type">moduleErrorMsg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-678"></span><span id="moduleErrorMsg"><span class="annot"><span class="annottext">moduleErrorMsg :: String -&gt; ShowS
</span><a href="Data.ByteString.Short.Internal.html#moduleErrorMsg"><span class="hs-identifier hs-var hs-var">moduleErrorMsg</span></a></span></span><span> </span><span id="local-6989586621679071711"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071711"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621679071710"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071710"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data.ByteString.Short.&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071711"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">':'</span></span><span class="annot"><span class="annottext">Char -&gt; ShowS
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">' '</span></span><span class="annot"><span class="annottext">Char -&gt; ShowS
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679071710"><span class="hs-identifier hs-var">msg</span></a></span><span>
</span><span id="line-679"></span></pre></body></html>